Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 371
AfBu Avatar asked May 04 '15 18:05

AfBu


People also ask

How do you edit multiple lines in VS code?

Use Ctrl + D to use multi word edit of same words in Windows and Linux. Use CMD + D for Mac.

How do I edit multiple text in Visual Studio?

In Visual Studio to edit multiple lines which are vertically aligned at once press Alt and select the aligned block and then just start typing as in example 1 below. This approach overwrites the selected block.

How do you use multiline space in VS code?

“how to indent multiple lines in vscode” Code Answer's and also indent backward using Shift + TAB.


1 Answers

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

Documentation:

https://code.visualstudio.com/docs/customization/keybindings

Official VS Code Keyboard shortcut cheat sheets:

https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf

like image 56
Nacimota Avatar answered Oct 11 '22 11:10

Nacimota