Skip to main content

VSCode Keyboard Shortcuts

VSCode has a lot of keyboard shortcuts to make your life easier. A lot. Perhaps you have consulted VSCode's own documentation for keyboard shortcuts on both MacOs and Windows. If you have looked at these documents, then you are likely not alone in what you may be feeling: how does this make my life easier? Which shortcuts are actually useful? How can I get up and running quickly with some useful shortcuts as well as test my memory of what shortcuts I think I know? This "guide" attempts to address some of these questions.

Getting Started

I have created two markdown files, one for MacOS and one for Windows, which essentially convert the PDFs linked to above into a "memory testing game" of sorts. You can click on either of these links to immediately get started (or keep reading for more info).

Sample Usage

Suppose you need to remember how to quickly copy a line(s) down or up. Then the following is how you could test your memory:

In MacOS

Copy line down/up
⇧⌥↓ / ⇧⌥↑

If you know the correct keystrokes to accomplish the above effect in MacOS, then good for you! If not, click the triangle to reveal the desired keystrokes: ⇧⌥↓ / ⇧⌥↑

Similarly, we have the following for Windows:

In Windows

Copy line down/up
Shift+Alt + ↓ / ↑

Desired keystrokes (click the dropdown triangle to test or refresh your memory): Shift+Alt + ↓ / ↑

Demo of Copying a Line Up/Down

Watch the following demo to see "copy line down" in action and how it might make your life easier. (The keystrokes used to accomplish this are highlighted to the right.)

vscode-keyboard-shortcuts-demo

Frequently Used Shortcuts

If you like what you saw above, then you may want to check out some of my own frequently used shortcuts listed below.

Editing Shortcuts

EffectMacOSWindows
Copy line down/up
Click for keystrokes
⇧⌥↓ / ⇧⌥↑
Click for keystrokes
Shift+Alt + ↓ / ↑
Move line down/up
Click for keystrokes
⌥↓ / ⌥↑
Click for keystrokes
Alt+ ↑ / ↓
Delete line
Click for keystrokes
⇧⌘K
Click for keystrokes
Ctrl+Shift+K
Indent/outdent line
Click for keystrokes
⌘] / ⌘[
Click for keystrokes
Ctrl+] / [
Go to beginning/end of line
Click for keystrokes
←⌘ / ⌘→
Click for keystrokes
Home / End
Go to beginning/end of file
Click for keystrokes
⌘↑ / ⌘↓
Click for keystrokes
Ctrl+Home / Ctrl+End
Add line comment
Click for keystrokes
⌘K ⌘C
Click for keystrokes
Ctrl+K Ctrl+C
Remove line comment
Click for keystrokes
⌘K ⌘U
Click for keystrokes
Ctrl+K Ctrl+U
Toggle line comment
Click for keystrokes
⌘/
Click for keystrokes
Ctrl+/
Toggle block comment
Click for keystrokes
⇧⌥A
Click for keystrokes
Shift+Alt+A

Multi-cursor and Selection Shortcuts

EffectMacOSWindows
Insert cursor
Click for keystrokes
⌥ + click
Click for keystrokes
Alt+Click
Undo last cursor operation
Click for keystrokes
⌘U
Click for keystrokes
Ctrl+U
Select current line
Click for keystrokes
⌘L
Click for keystrokes
Ctrl+L
Select all occurrences of current selection
Click for keystrokes
⇧⌘L
Click for keystrokes
Ctrl+Shift+L