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.
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.
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)
File > Preferences > Keyboard Shortcuts
. Then search for cursorColumnSelect
, 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 for Shift
+ Alt
+ Drag, but right now, there's no way to register a mouse button down event in Electron.
Commented
Apr 29, 2018 at 23:58
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.
As none of the existing answers mention this:
The simplest way to achieve the desired result (as of April 2018 version 1.23) is to middle click and drag.
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.
SetTitleMatchMode, 2
so it accepts wildcard titles. A VSCode window shows Filename.txt - MyFolder - Visual Studio Code
Visual Studio Code
. Need to set the title match mode to 2 so it searches that the title contains the text.
As of Visual Studio Code 1.2, they have full column selection. See Column (box) selection
For all you visual learners, there is (as of version at least version 1.55) a graphical menu way to turn it on and a even faster way to turn it off. Go to Selection
\ Column Selection Mode
to toggle this feature on or off. If Column Selection Mode
is enabled, there is a notice in the bottom VSCode status bar (circled in red in my illustration). A quick click on this notice will turn it off.
On a Mac, to use only the keyboard, I just had to use Cmd+Shift+Opt and then arrow keys.
I have tested this on Windows 10 Pro 1909 and Linux Mint 19.3 VSCode 1.45.1 on both OS's. When I was holding Shift+Alt+Mouse Click it was dragging the Window around. What might be a better explanation is this:
HOLD down LEFT mouse button
anywhere in the code then press and HOLD SHIFT+ALT
. With all 3 Held down drag mouse in any direction with the mouse for column select.
Click the somewhere at top line of the text. Select none or select some text. Hold the Shift
key and click the somewhere in the following lines.
Sublime text has this shortcut to select columns: Ctrl + Alt + Up or Ctrl + Alt + Down
So with just adding this extension to VSCode: Sublime Text Keymap and Settings Importer.
You can use the shortcut and done!.