A multi-cursors editing is a technique that allows a user to select multiple lines and make multiple simultaneous edits at once.
The multiple cursors feature is available in a Visual Studio Code (VSCode) out of the box.
This short note shows how to select and edit multiple lines simultaneous using the VSCode’s multiple cursors feature.
Cool Tip: How to reset a Visual Studio Code! Read more →
Multiple Cursors in VSCode
Use the following keyboard shortcuts to enable multi-line editing in the Visual Studio Code:
Keyboard Shortcut | OS |
---|---|
Ctrl + Alt and then ↑ or ↓ | Windows |
Shift + Alt and then ↑ or ↓ | Linux |
⌥ Opt + ⌘ Cmd and then ↑ or ↓ | MacOS |
Here is how the multi-line editing in the Visual Studio Code looks like:
You can also place the cursors arbitrarily by holding the Alt key and left-clicking:
To switch back from the multi-cursors editing to a single cursor, press the Esc key.
Cool Tip: How to clone a Git repository in a Visual Studio Code! Read more →
To view or edit shortcuts, go to the “File” → “Preferences” → “Keyboard Shortcuts”.
FYI – These shortcuts don’t work on a fresh new installation.
Hi, Have just checked it with the latest version 1.66.2 on Windows and the shortcuts are still working fine there.
Issue exists in some conditions:
https://github.com/microsoft/vscode/issues/68109
https://github.com/microsoft/vscode/issues/68003
Thank you!