449

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.

Jim Fell
  • 6,099
ChiliYago
  • 5,415

11 Answers11

552

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)

tayopi
  • 5,678
166

On macOS: Shift+Option and mouse, or Shift+Option+Cmd and arrow keys

Screenshot: enter image description here

MarkHu
  • 741
DrStrangepork
  • 1,855
  • 1
  • 13
  • 12
48

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.

VS Code - Selection Menu - Switch to

Calibr3
  • 589
18

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.

Torantula
  • 180
10

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.

9

As of Visual Studio Code 1.2, they have full column selection. See Column (box) selection

Steve
  • 537
9

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.

enter image description here

wruckie
  • 310
4

On a Mac, to use only the keyboard, I just had to use Cmd+Shift+Opt and then arrow keys.

kidbrax
  • 141
1

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.

0

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.

edib
  • 143
0

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!.