Selecting columns in Visual Studio Code
Solution 1
In Visual Studio Code version 1.0, you can now select columns by holding down Shift+Alt, then click and drag with the mouse. This can also be done using just the keyboard by holding down Ctrl+Shift+Alt and then using the arrow keys.
On latest version of vscode - 1.45.1, you can achieve same by Shift+Alt itself ( verified in May 2020)
Solution 2
On macOS: Shift+Option and mouse, or Shift+Option+Cmd and arrow keys
Solution 3
For the ones who have tried to use the Alt Key + Mouse Selection, and failed. Try to Click the menu selection as follows:
Menu bar > Selection > {Click} Switch to Ctrl+Click for Multi Cursor. This will change the multi selection the with Ctrl key and mouse as well as enable to selection column selection with the Alt Key + Mouse Selection.
https://i.stack.imgur.com/x8tJN.png
Solution 4
I just published an extension for Visual Studio Code that converts a multi-line selection into a column selection. It mimics TextMate's Toggle Column Selection command and serves as an alternate approach to Visual Studio Code's commandoptionshift + arrow keys that I find more natural to work with.
Solution 5
As of Visual Studio Code 1.2, they have full column selection. See Column (box) selection
Related videos on Youtube

robjw
Updated on September 18, 2022Comments
-
robjw 8 months
Does Visual Studio Code support selecting columns of text?
I have not yet found this feature, so I am wondering if it is hidden somewhere. I am familiar with holding down Alt while selecting text, but Visual Studio Code does not behave this way.
-
Admin about 7 yearsIt sure is. Hold down the Alt key and select a column of text. It has been there for as long as I can remember.
-
Admin about 7 years0.10.11 doesn't select a column of text for me. Was looking for the feature also.
-
Admin about 7 yearsLooks like there is some work on it though. github.com/Microsoft/vscode/issues/4092
-
Admin almost 5 yearsFrom April 2018 (version 1.23), we can use middle mouse button to select multiple columns. code.visualstudio.com/updates/…
-
Admin almost 5 yearsVS Code doesn't have real column select. Compare: actual column select to VSCode's strange not really column select. Waiting for VSCode to support virtual space so actual column select can be added.
-
Admin over 4 yearsi haven't found a solution for being able to column select by dragging instead of arrow buttons.
-
-
Steve over 5 yearsIt's really "click, shift+alt+drag". Much less convenient than VS classic's "alt+drag". Is there any way to make VS Code work exactly like VS?
-
Lars Nyström over 5 yearsFor me it is Shift+Cmd and mouse. Maybe it has changed?
-
tom_mai78101 about 5 years@Steve
File > Preferences > Keyboard Shortcuts
. Then search forcursorColumnSelect
, then you can modify the keyboard shortcuts. This is done on VS Code, version 1.22. Of note,columnSelect
is what you would need to change forShift
+Alt
+ Drag, but right now, there's no way to register a mouse button down event in Electron. -
ThatsAMorais about 5 yearsOn OS X I had to use Right
Shift
,Alt
,Ctrl
as Left did not work. -
gman almost 5 yearsThis not a column select by the definition of any editor that's ever had column select. VSCode doesn't put columns through virtual space making it useless since it's not actually a column. Compare actual column select to VSCode's strange not really column select
-
Franklin Yu over 4 years@gman What's your reference for "actual column select"? Was it Sublime Text?
-
gman over 4 years@FranklinYu, visual studio (not vscode), emacs, intelli-j, notepad++, slickedit, and lots more... Been using real column editing since at least brief in the late 80s. Not saying that's the first, just that's when I started using and needed the feature and find that editors that are missing it hinder me.
-
Franklin Yu over 4 years@gman All right, Vim and Sublime Text does not do that. (That's why I was asking.) In addition, this feature is assuming that indentations are all tabs. This works most of the time, but we have to avoid some projects like Linux kernel or Git.
-
gman over 4 yearsNot it is not assuming indentation is all tabs. Well programmed editors can handle tabs or spaces or a mix just fine.
-
Kevin Farrugia over 4 yearsPlease update the answer as it is now Shift+Cmd on OSX.
-
Alex R over 4 yearsthe fact that I have to google it and come here everytime I need to do this, means this shortcut is just not good enough..
-
Code4Days over 4 yearsIt has not changed. Yours is Shift+Cmd because you chose "Selection > Switch to Cmd+Click for Multi-Cursor"
-
Orangutech over 4 years"The real answer", etc.
-
Myer about 4 years@Eric I basically have defaults, haven't selected that option, and it's Shift+Cmd for me in vscode insiders 1.31 on mac 10.14
-
DrStrangepork about 4 yearsThe default is Shift+Option. If you select "Selection > Switch to Cmd+Click for Multi-Cursor", then it will change to Shift+Cmd. If you then select "Selection > Switch to Alt+Click for Multi-Cursor", then it will change back.
-
Jack almost 4 yearsYour AutoHotKey example is missing this line at the top
SetTitleMatchMode, 2
so it accepts wildcard titles. A VSCode window showsFilename.txt - MyFolder - Visual Studio Code
-
Erik P. Hansen almost 4 years@Jack I'm actually not familiar with how AutoHotKey works (those instructions came via a PR from someone else). But it sounds like you're saying that hotkey currently triggers in all apps, not just VSCode? I wouldn't want to make the window title matching too strict, though, since I know that the info in the window title is user configurable.
-
Jack almost 4 yearsNo currently it doesn't trigger at all because it never finds the exact text
Visual Studio Code
. Need to set the title match mode to 2 so it searches that the title contains the text. -
Erik P. Hansen almost 4 years@Jack Thanks for the tip! I've updated the readme. Hopefully the instructions work now but I can't test it as I don't have access to a Windows machine these days.
-
vhs over 3 yearsWorks without any keyboard remapping on a fresh install of Catalina.
-
emem over 3 yearsOn VSCode 1.4 not working as in the documentation - more like the comments above
-
christopherbalz over 3 yearsHoping for this: github.com/rkwan94/vscode-emacs/issues/16
-
Jay Bienvenu about 3 yearsIn my instance of VSCode, the
cursorColumnSelect*
commands have a predicateeditorColumnSelection && textInputFocus
. The bindings aren't working, which leads me to believeeditorColumnSelection
is the issue. What doeseditorColumnSelection
represent? -
MrWhite almost 3 years"On latest version of vscode - 1.45.1, you can achieve same by Shift+Alt itself ( verified in May 2020)" - Doesn't work for me in 1.46 (June 2020). In fact, the docs state that
Shift
+Alt
+Left
/Right
are for "shrink/expand selection", which is a different thing. (?) -
omostan almost 3 yearsI find this answer to be the best and should be the accepted answer. I have no idea why others are given long and inadiquate answers that seem to be accepted by majority of viewers.
-
Andreas almost 3 years
Shift
+Alt
+left
doesn't do anything in my VS Code 1.46.1 -
Peter Mortensen over 2 yearsThis seems to be Apple only.
-
Peter Mortensen over 2 years@omostan: Agreed. They do not work at all.
-
Peter Mortensen over 2 yearsNone of this works on Linux (Ubuntu 20.04 with Cinnamon). What works: first Shift + Alt + arrow key down. Then first extend the selection down with Shift + arrow key down. Followed by extending the selection horizontally with Shift + Alt + arrow key right. Details are in my blog post Keyboard-only use of block/column mode in different text editors (Geany, Visual Studio, UltraEdit, Notepad++, Visual Studio Code, and Vim) (also covers Windows).
-
Peter Mortensen over 2 yearsPerhaps it is time to update this answer to something that actually works?
-
DrStrangepork over 2 yearsYes, the answer says "On macOS"
-
Willem about 2 yearsTo anyone looking through these answers: this is the one that works!
-
Matt Kenefick about 2 yearsAgreed. This one seems to get to the point. Maybe it was introduced in a later version, but this allows you to use "ALT+CLICK" in VS Code
-
WestCoastProjects about 2 yearsNone of the Keyboard shortcuts shown here work for macOS including converting Alt to Option and control to command
-
WestCoastProjects about 2 years@PeterMortensen Agreed. none of the keyboard stuff works on macOS
-
WestCoastProjects about 2 yearsBrilliant: this works perfectly
-
Alexis almost 2 yearsIs it only me or when I want to have all the cursors at the end of each line, it's impossible?
-
jciloa almost 2 yearsAlso, Option + Click for placing multiple cursors in the text.
-
hepcat72 over 1 yearWhat version of macOS are you on @WestCoastProjects? I'm on Big Sur and
click, opt-shift-click&drag
work for me. It works the exact same way asclick, opt-shift-click&drag
in Text Edit (except in text edit you can also just opt-click&drag - you don't need the superfluous click and shift). -
Gabriel Staples over 1 yearNotice that when using
Shift
+Alt
then clicking and dragging with the mouse, the place your cursor starts really matters. So, begin by clicking on a desired starting cursor point first, then do theShift
+Alt
+ mouse-click-and-drag column-select trick. -
Toto over 1 yearHow is this better than accepted answer?
-
Evert Homan over 1 yearWorks for me, tested on both Mac and Windows.