gepoch / vim-surround

Surround for the Atom editor.
MIT License
52 stars 2 forks source link

Whenever I press `s`, highlighted character get deleted when attempting to invoke surround command when using vim-mode #18

Closed lozandier closed 9 years ago

lozandier commented 9 years ago

For some reason when Vim mode is active, s deletes the first character before surround is invoked to surround the text object.

gepoch commented 9 years ago

Hey!

So by default, the vim-mode package actually binds visual-mode's s command to "substitute", which will remove your visual selection, and then drop into insert mode.

vim-surround shadows this keybinding so that "s" actually does the surround action. There is a small delay in which you can insert the surrounding pair before vim-mode goes back to assuming that you meant to do a substitution.

So! Type faster, OR you can go into the vim-surround package setting and change the surround command key from lowercase s to uppercase S (which is actually the default key for the classic surround plugin for vim) Then you won't need to worry about the delay for substitute kicking in. You'll just need to switch to uppercase S when you want to surround things. Does that all make sense?

lozandier commented 9 years ago

Thanks for the clarification & history. That all made sense to me.

Vim's actually my primary editor of choice w/ vim-surround installed via Vundle; I use it all the time but totally didn't know that about its earlier implementation.

On Tuesday, May 26, 2015, George Marchin notifications@github.com wrote:

Hey!

So by default, the vim-mode package actually binds visual-mode's s command to "substitute", which will remove your visual selection, and then drop into insert mode.

vim-surround shadows this keybinding so that "s" actually does the surround action. There is a small delay in which you can insert the surrounding pair before vim-mode goes back to assuming that you meant to do a substitution.

So! Type faster, OR you can go into the vim-surround package setting and change the surround command key from lowercase s to uppercase S (which is actually the default key for the classic surround plugin for vim) Then you won't need to worry about the delay for substitute kicking in. You'll just need to switch to uppercase S when you want to surround things. Does that all make sense?

— Reply to this email directly or view it on GitHub https://github.com/gepoch/vim-surround/issues/18#issuecomment-105548521.

Kevin Lozandier lozandier@gmail.com lozandier@gmail.com

gepoch commented 9 years ago

Ah! Indeed. Give it a try. Vim-surround for Atom doesn't really have as many features as surround for vim, but more features coming soon-ish? I need a good weekend to delve into the vim-mode API. Currently, vim-surround is mostly a hack. The rewrite is coming though :)