This content originally appeared on DEV Community and was authored by Akshay Joshi
Multi-cursor editing allows you to make multiple changes at once, which can be a huge time-saver.
How to Use Multi-Cursor Editing:
-
Add Cursors at Multiple Locations:
-
Windows/Linux: Press
Ctrl + Altand use the arrow keys to add a cursor above or below the current line. -
Mac: Press
Cmd + Optionand use the arrow keys to add a cursor above or below the current line.
-
Windows/Linux: Press
-
Add Cursors with Mouse:
-
Anywhere: Hold
Altand click at the locations where you want to add cursors.
-
Anywhere: Hold
-
Add Cursors to Next Occurrence:
-
Windows/Linux: Press
Ctrl + Dto add a cursor to the next occurrence of the selected text. -
Mac: Press
Cmd + Dto add a cursor to the next occurrence of the selected text.
-
Windows/Linux: Press
-
Select All Occurrences:
-
Windows/Linux: Press
Ctrl + Shift + Lto select all occurrences of the current selection. -
Mac: Press
Cmd + Shift + Lto select all occurrences of the current selection.
-
Windows/Linux: Press
Example Usage:
-
Changing Variable Names:
If you need to change a variable name across multiple lines:- Select the variable name.
- Press
Ctrl + DorCmd + Dto add cursors to each occurrence. - Type the new name.
-
Editing Multiple Lines:
If you need to add the same text at the beginning or end of multiple lines:- Use
Ctrl + Alt + Down ArroworCmd + Option + Down Arrowto create multiple cursors. - Type the text you want to add.
- Use
Multi-cursor editing is a powerful feature that can significantly speed up your coding workflow in VSCode.
Happy Coding!!!
This content originally appeared on DEV Community and was authored by Akshay Joshi
Akshay Joshi | Sciencx (2024-08-03T04:00:40+00:00) VSCode Tip 2 : Multi-Cursor Editing. Retrieved from https://www.scien.cx/2024/08/03/vscode-tip-2-multi-cursor-editing/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.