vim-multiple-cursors icon indicating copy to clipboard operation
vim-multiple-cursors copied to clipboard

Feature Request: support for surround-plugin

Open hallosascha opened this issue 11 years ago • 7 comments

I would like to be able to create multiple cursors and then, surround the underlying words say with quotation marks using surround.vim. For example, I would like to change

Some text quote more text quote and even more text quote.

to

Some text "quote" more text "quote" and even more text "quote".

by issuing S" after entering the multiple cursor mode. This does not work yet. It would be really great to combine these two wonderful plugins to work together!

hallosascha avatar Jul 04 '15 10:07 hallosascha

Agree this would be great! PR always welcome

faceleg avatar Jan 26 '16 19:01 faceleg

:map B ysiw"
vB

works

nagarajasr avatar Jan 06 '17 13:01 nagarajasr

@nagarajasr is there a way to set Vim up so it can wrap / surround a word with any character ? Your command above uses the quote, but I'd love to be able to use the same type of command for {} () "" or others w/ Multiple Cursors as well. Any thoughts? Thank you!

andrewdelprete avatar Apr 11 '17 05:04 andrewdelprete

sure go right ahead and use whatever character instead of ", it just works :-) e.g., with ysiw{ or ysiw( the word is correctly surrounded with matching closing character (i.e., { with }, ( with ) ) with angle bracket <, the behaviour is slightly different, vim waits for further input terminated by carriage return, and the word is surrounded with a html start and end tag like this: if you key in ysiw<span you get <span>word</span> use ysiw> to surround the word itself in <> instead of surrounding the word with a html tag. another cool thing is if you ysiw(, the word is padded with a space, with ysiw), there is no padding. use ysiw to pad a word on both sides with a space. ysiw\ inserts what appears to be a latex directive( or macro?)

nagarajasr avatar Apr 11 '17 14:04 nagarajasr

Hey @nagarajasr thank you!

andrewdelprete avatar Apr 12 '17 15:04 andrewdelprete

While the proposed solution "kind of" works is not actually flexible :/ And you would need to do a lot of mappings: ys.. ds.. cs.. and text objects and enclosures, the combinations are quite a lot.

karamfil avatar Sep 23 '17 20:09 karamfil

My new hope is this: https://github.com/neovim/neovim/issues/7257

balta2ar avatar Sep 23 '17 20:09 balta2ar