Multiline editing in Visual Studio Code


Is it possible to enable multiline editing like in Sublime Text?

For example, press Ctrl to place additional cursor carets and being able to write/delete on multiple places in the document at one time.

Best Solution

On Windows, you hold Ctrl+Alt while pressing the up or down arrow keys to add cursors.

Mac: ⌥ Opt+⌘ Cmd+/

Linux: Shift+Alt+/

Note that third-party software may interfere with these shortcuts, preventing them from working as intended (particularly Intel's HD Graphics software on Windows; see comments for more details).

If you experience this issue, you can either disable the Intel/other software hotkeys, or modify the VS Code shortcuts (described below).

Press Esc to reset to a single cursor.

Multiline cursors in Visual Studio Code

Or, as Isidor Nikolic points out, you can hold Alt and left click to place cursors arbitrarily.

Arbitrarily placed multiline cursors in Visual Studio Code

You can view and edit keyboard shortcuts via:

File → Preferences → Keyboard Shortcuts


Official VS Code Keyboard shortcut cheat sheets: