Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
msilen opened this issue Apr 30, 2012 · 8 comments
Closed

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

msilen opened this issue Apr 30, 2012 · 8 comments

Comments

@msilen
Copy link

msilen commented Apr 30, 2012

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
Copy link
Owner

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
Copy link
Author

msilen commented May 1, 2012

Thanks. The line solved the issue.

@jbmartin
Copy link

jbmartin commented Jul 2, 2014

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
Copy link
Owner

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

@jbmartin
Copy link

jbmartin commented Jul 2, 2014

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
Copy link

jbmartin commented Jul 2, 2014

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

@maxbrunsfeld
Copy link
Owner

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

@jbmartin
Copy link

jbmartin commented Jul 2, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants