I use VsCode with Neovim extension. Sometimes I have to add different quotations or underscores or edit parentheses around a word but the words or marks around them aren't always straightforward or simple or even full words.

So I regularly need a selection with the added features of VsCode itself. I currently have to resort to mouse for this because I can't persist the selection from normal mode to input mode either.

Is there any solution or plugin that lets me switch modes while persisting the selection?

2 Answers 2


The VSCodeVim extension for VsCode:

enter image description here

Has support for the surround extension:

enter image description here

With this extension you can:

  • Add quote to your selection with the following action (in visual mode): S".
  • Change from single quote to double quote with: cs'"
  • Remove surrounding brace with: ds)
  • And much more ...
  • 1
    Thank you for the quick answer. This functionally satisfies my need, but still feels like a workaround for the specific case of adding surrounding marks, aside from needing more keys in case of adding things like {()} which turns up quite a lot. There should be some way of persisting selection when switching modes somewhere. And for future reference neovim extension also supports this because it uses an actual neovim instance. you can install surround on neovim and it'll work in VsCode as well.
    – mpower
    Oct 2, 2023 at 6:03

When switching to the insert mode the extremity of the last selection are still available via the < and > mark.

e.g. to put quote around your selection you could do:

  • " insert the starting quote
  • Ctrl o`> move to the end of the selection
  • " insert ending quote
  • Ctrl o`> move back to the start of the selection

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.