maxbrunsfeld / vim-yankstack

A lightweight implementation of emacs's kill-ring for vim
437 stars 29 forks source link

surround-vim can't work with yankstack simultaneusly #9

Closed msilen closed 12 years ago

msilen commented 12 years ago

I use tpope's surround-vim plugin. When I have both surround.vim and yankstack installed I can't surround objects in visual mode. For example if I have a visually selected word, pressing S" suppose to produce "word", but instead i get _, and i end up in the insert mode.

maxbrunsfeld commented 12 years ago

I also use vim-surround, together with yankstack. They are compatible. Here's the situation:

What you're seeing is the default behavior of the S key in visual mode. What's happening is that yankstack is getting loaded after vim-surround, so vim-surround's key-bindings are getting clobbered. I believe all you have to do is put the following line in your vimrc:

call yankstack#setup()

This will cause yankstack to set up its key-bindings immediately, before vim-surround gets loaded. Let me know if this fixes it for you. I want to make sure I don't interfere with anybody's use of vim-surround.

msilen commented 12 years ago

Thanks. The line solved the issue.

jbmartin commented 10 years ago

While this solution prevents 'S' (uppercase) from being clobbered by yankstack, 's' (lowercase) still deletes the selection in visual mode.

:verbose vmap s
s  s             <SNR>29_yank_with_key("s")
        Last set from ~/.vim/bundle/vim-yankstack/autoload/yankstack.vim
x  s           * <SNR>29_yank_with_key("s")
        Last set from ~/.vim/bundle/vim-yankstack/autoload/yankstack.vim
maxbrunsfeld commented 10 years ago

@jbmartin, can you describe the behavior that you expect and the behavior you're observing?

jbmartin commented 10 years ago

According to the surround documentation, typing viws" should surround the word under the cursor with double quotes. Instead, yankstack is deleting it. For example, suppose the target word is hello. Typing viws" should result in "hello", but instead it's blank.

jbmartin commented 10 years ago

This might be a moot point. viwS" performs the desired surround behavior.

maxbrunsfeld commented 10 years ago

As far as I know, vim-surround does not map 's' in visual mode, only capital 'S'.

jbmartin commented 10 years ago

You're right. Apparently, I haven't updated my surround.vim documentation in awhile. 's' was removed here.