Multi-cursor in Visual Studio Code
Sergiu Mureşan Nov 9
Multi-cursor is one of those features that impresses many non-programmers but, in our world, this is quite an old one. Many people know about this but I think they are not using it to its full potential. So here is what you can do with multi-cursor:
1) Add multi-cursor below/above (
This is a simple functionality but it's hidden by its strange shortcut that also turns your screen upside-down. I always re-bind this functionality to
↓ so it's the same with Visual Studio.
2) Add multi-cursor to next occurrence (
Simply select a piece of text, and when you use this shortcut it will add another cursor to the next occurrence of the selected text, after that, you can edit both at once. This will help you edit code real fast.
3) Add multi-cursor to all occurrences (
Same mechanism as above but instead of just adding a cursor to the next occurrence it adds it to all the occurrences in the current file. This can be a really quick and flexible find and replace.
4) Undo last cursor operation (
This one I didn't know about for a long time. It's simple and straightforward. If you accidentally add too many cursors you can undo that operation using this shortcut. It will help you from the hassle of going aaaallll the way back and re-selecting only the occurrences you need.
And that's it! They are fairly simple and straightforward features that you can 100% customize their key binding.
I hope this helped you, I know it helped me!
- What features do you think are worth checking out next?
- Do you know anything I missed relating this feature?