hauleth/sad.vim

Interference with vim-surround

michaelfresco opened this issue · 4 comments

Really interesting plugin. I noticed that it only started working for me, after I deleted tpope/vim-surround though.

What's the best way to go about this? Can we remap siw to another mapping? Perhaps ctl-n?

Ok, it seem that I didn't document it well enough, but sad will not create any mappings if there already is one for either <Plug>(sad-change-forward) or <Plug>(sad-change-backward). So all you need to remap them is to do:

nmap <C-n> <plug>(sad-change-forward)

However in this particular case I would advise choosing other mapping rather than <C-n> as this one is useful for completion ;)

As about working with vim-surround I have no problems with it even if I keep default mappings.

I took a dive into the code and I understand it now. The real difficulty is finding a key(*) that is not being used. The plugin works flawlessly though. Sweet stuff.

* http://vim.wikia.com/wiki/Unused_keys

@michaelfresco alternative for you would be forcefully add:

" If you want surround visual `S` mapping
xmap S <Plug>VSurround

" If you want sad visual `S` mapping
xmap S <Plug>(sad-change-backward)

in after/plugin/surround.vim. This should force setting S to whatever behaviour you would prefer. No other mappings overlaps in these two plugins, so it should be it.

Damn, it was just that capital S mapping that was the problem all along. Thanks for writing the additional comment!