DEV Community

Ryan Carter
Ryan Carter

Posted on • Updated on

Vscode Multiple Cursors Multi-Select in Visual Studio Code


I am suddenly using VS Code because of multi-select (they call it multi-cursor in VS Code). Never thought I would. How the mighty have fallen.

Mac: Multi-Cursor Shortcuts

(these probably work on Windows with some experimentation):

Some shortcuts first, if that is all you're here for. Otherwise my rambling is below too, you know, if you're into that sort of thing. :)

NOTE: I use the "Selection => Switch to Cmd + Click for Multi-Cursor" option.

Mac: Shift + Cmd + L

Select a word and press Shift + Cmd + L to select all instances of your selection.

Shift + Alt/Option + I

Select a bunch of lines, then Shift + Alt/Option + I will put a cursor at the end of every selected line.

Cmd + Option + Shift + UP/DOWN (ARROW)

Selects in a column directly up or down from the cursor's position.

Alt/Option + Click

Selects each instance with a new cursor

See the VS Code Key Bindings page for more info on OS specific shortcuts

Senseless Rambling:

The best feature in Sublime Text 2/3 is hands down the multi-select feature. I've used it in many languages/stacks for years. It allows you to highlight a word, then automatically edit all instances of that word in your file. You can also select all lines in a column to edit many rows of data at the same time. It is basically the editing power of vim but more simple and graphical for vim noob idiots like me.

Multi-select is the one thing that has stopped me from moving to another editor for a very long time. Several others have tried to replicate the feature, but none of them seem to get it right, enough to feel as smooth and effortless like Sublime does.

That was until recently when I looked at VS Code and gave it another shot. I initially stopped using it right away because I was trying to write Vue code and the plugins for Vue really did not work correctly and messed up the spacing. I tried it again, and found that it does have multi-select and delightfully is easier to use than most. It isn't quite as good as the original Sublime implementation, but is good enough to make me switch over to use VS Code for most things.

To be fair, I am a bit surprised I like a Microsoft product for programming this much. Microsoft has been making strides for years in many areas and shed the old world view of proprietary nonsense to a large degree. They have truly embraced the open source world with decent offerings. Enough that I have switched. I have gone to the dark side. I don't know if they have cookies, but I'm diabetic so that's a no go anyway. I digress.

There are many other things that make me like VS Code too, but I won't likely be writing Vue/React in it anytime soon, depending on whether it can handle the JSX and other space-formatting issues I had. The built in terminal is very nice, as well as the easy extension support and intelligent features of updates and generally knowing what I want before I need it. Very well done. I appreciate that actual developers make this IDE and made it good for the masses.

Well Microsoft, you did it. I finally embrace our overlords. Coincidence that Steve Ballmer had to leave for me to get on board with your evil plan for world development domination? I think not.

NOTE: Cross-posted from my personal site.

Top comments (3)

ahmadpak profile image

Thank you so much.

bicho44 profile image
Federico Reinoso

Thanks a lot

sumeetchawla profile image
Sumeet Chawla

Thank you so much. I kept forgetting how to add multi cursor after selecting multiple lines.