This article provides a list of VSCode shortcuts that can help you make selections, add multiple cursors, fold and unfold code, and more. These shortcuts can make navigating and editing your code easier and save you time and effort.
Intellisense
Shift+Cmd+Space – display list of function argument
Selection
Ctrl+Shift+Right – expand the selection to the bigger context
Ctrl+Shift+Left – shrink selection to a smaller context
Ctrl+D – find the next instance of the selected block and add it to the selection
Ctrl+L – extend the selection to the whole line
Shift+Cmd+L – select all instances of the selected block
Multi-cursor
In VSCode, the multi-cursor feature allows you to add multiple cursors to your code, which can be useful for making multiple edits at once. For example, if you want to change the name of a variable that is used multiple times in your code, you can use the multi-cursor feature to add a cursor to each instance of the variable, and then make the changes simultaneously.
Option+LClick – add a new cursor to the clicked position
Shift+Option+I – create a cursor for every selected line
Option+Cmd+Down (Up) – add cursor below (above)
Cmd+U – undo cursor
Folding/Unfolding
The folding feature allows you to collapse blocks of code, making it easier to navigate and focus on specific parts of your code. This can be useful for hiding code that you are not currently working on and for making it easier to navigate large files.
Cmd+K Cmd+0 – fold everything
Cmd+K Cmd+- – fold everything except the region under the cursor
Cmd+K Cmd+] – unfold recursively under the cursor
Cmd+K Cmd+J – unfold everything
Cmd+K Cmd+2 – fold to level 2 (change 2 to another digit to specify another level for folding)
Miscellaneous
Ctrl+J – join lines
Cmd+K Cmd+F – apply document formatting to the selection
Shift+Cmd+T – reopen a closed document