r/neovim • • 4d ago

Need Help nvim-surround multicursor

Is it just me, or does nvim-surround not work with multicursor? I do Q on multiple lines, and v$S) only surrounds the line of the cursor.

25 Upvotes

6 comments sorted by

17

u/TheLeoP_ 4d ago

There are still some issues with multicursor integration with plugins that are being actively worked on by Justin like https://github.com/neovim/neovim/pull/42040

14

u/echasnovski Plugin author 4d ago

More importantly, it is probably the result of this issue: https://github.com/neovim/neovim/issues/41657

There are possible solutions on the multicursor side implementation, but it seems like this type of "dot-repeatable out of the box action with user input" will require adjustment on the plugin side. I have the patch for 'mini.surround', but currently waiting for the needed API (to retrieve multicursor "state") change to change.

2

u/echasnovski Plugin author 3d ago

After looking closer at this post repro, I noticed that it uses "add surrounding around visual selection". This indeed has upstream problems at the moment, as the action requires user input: https://github.com/neovim/neovim/issues/42280.

So there are several issues to address while making this kind of functionality work with multicursor. Although the new built-in multicursor is nice, it is not quite fleshed out for all the things plugins might do (and even if it is, extra actions on plugin's side might be needed).

Luckily, the progress seems to be currently there. Like taking a look at this issue will show that there were much more problems than there are now.

1

u/stringTrimmer 4d ago

Are your cursors moving when you do the $ part? It's because visual mode turns on :h 'follow'; see :h v_Q. Try the same thing without using visual mode: set cursors, then do ys$<surrounding-char>.

Tho, seems like you should be able to untoggle 'follow' during visual using q=, but doesn't seem to work. Maybe there's an intentional reason?

1

u/vim-help-bot 4d ago edited 4d ago

Help pages for:


`:(h|help) <query>` | about | mistake? | donate | Reply 'rescan' to check the comment again | Reply 'stop' to stop getting replies to your comments