DEV Community

Discussion on: Boost Your Coding Fu With Visual Studio Code and Vim

 
vintharas profile image
Jaime GonzĂĄlez GarcĂ­a

Hmm I'd swear this used to work. 😅 I'm going vacation but I'll take a look when I'm back 😊

Thread Thread
 
mikaoelitiana profile image
Mika Andrianarijaona

Ok thanks ;). Have a nice holiday then 🏖

Thread Thread
 
mikaoelitiana profile image
Mika Andrianarijaona

In fact, it works on normal mode and entering in insert mode would keep the multiple cursors.

Thread Thread
 
vintharas profile image
Jaime GonzĂĄlez GarcĂ­a

Thank you! And you're right, I found this issue on their github repo:

github.com/VSCodeVim/Vim/issues/2439

which describes your problem. I'm pretty sure this used to work but they must've had a regression (but perhaps I'm wrong XD)

It looks like the current implementation is somewhat experimental. The flow you describe seems to work pretty well from normal mode. And if you want to add multiple cursors based on keyword search you need to:

  1. cursor on top of something
  2. cmd-d or gb to add another cursor
  3. This seems to put Vim into visual mode (ready to operate on the selection which makes sense)
  4. cmd-d or gb to continue adding cursors until you're done
  5. Now you can perform an action in visual mode (delete, change, etc) or,
  6. go back to normal mode with ESC and do any normal mode command keeping the multiple cursors

There's a feature in Vim that may solve your use case slightly faster than multiple cursors called Visual Block:

  1. CTRL-V to change to visual block mode
  2. j to select a rectangle of text downwards
  3. I to insert or A to append, insert text and ESC

(The VSCode implementation seems to use multiple cursors under the hood anyway :D)