shortcutsguide

VS Code Keyboard Shortcuts

Code faster — the VS Code shortcuts worth memorising, Mac and Windows side by side.

ActionMacWindows
Command Palette ⌘⇧P Ctrl+Shift+P
Quick Open file ⌘P Ctrl+P
New file ⌘N Ctrl+N
Save ⌘S Ctrl+S
Save all ⌥⌘S Ctrl+K S
Close editor ⌘W Ctrl+W
Reopen closed editor ⌘⇧T Ctrl+Shift+T
Toggle sidebar ⌘B Ctrl+B
Toggle integrated terminal ⌃` Ctrl+`
Toggle panel ⌘J Ctrl+J
Split editor ⌘\ Ctrl+\
Find ⌘F Ctrl+F
Replace ⌥⌘F Ctrl+H
Find in files ⌘⇧F Ctrl+Shift+F
Go to line ⌃G Ctrl+G
Go to symbol ⌘⇧O Ctrl+Shift+O
Go to definition F12 F12
Peek definition ⌥F12 Alt+F12
Rename symbol F2 F2
Format document ⇧⌥F Shift+Alt+F
Comment line ⌘/ Ctrl+/
Block comment ⇧⌥A Shift+Alt+A
Copy line up/down ⇧⌥↑/↓ Shift+Alt+Up/Down
Move line up/down ⌥↑/↓ Alt+Up/Down
Delete line ⇧⌘K Ctrl+Shift+K
Insert line below ⌘Return Ctrl+Enter
Insert line above ⌘⇧Return Ctrl+Shift+Enter
Add cursor above/below ⌥⌘↑/↓ Ctrl+Alt+Up/Down
Select next occurrence ⌘D Ctrl+D
Select all occurrences ⇧⌘L Ctrl+Shift+L
Indent / outdent ⌘] / ⌘[ Ctrl+] / Ctrl+[
Fold region ⌥⌘[ Ctrl+Shift+[
Unfold region ⌥⌘] Ctrl+Shift+]
Trigger suggestion ⌃Space Ctrl+Space
Quick fix ⌘. Ctrl+.
Open settings ⌘, Ctrl+,
Toggle word wrap ⌥Z Alt+Z
Zen mode ⌘K Z Ctrl+K Z
Navigate back ⌃- Alt+Left
Navigate forward ⌃⇧- Alt+Right

Two shortcuts do most of the work

If you learn only two VS Code shortcuts, make them the Command Palette — Ctrl+Shift+P (Win) / ⌘⇧P (Mac) — which runs any command by name, and Quick Open — Ctrl+P / ⌘P — which jumps to any file by typing part of its name. Everything else is a convenience on top of these two.

Multi-cursor editing

Select a word and press Ctrl+D / ⌘D repeatedly to add the next matching occurrence to your selection, then type once to change them all. Ctrl+Shift+L / ⇧⌘L selects every occurrence at once. Add stacked cursors with Ctrl+Alt+Up/Down (Win) / ⌥⌘Up/Down (Mac). Move a line with Alt+Up/Down / ⌥Up/Down and duplicate it with the Shift variant — no cut-and-paste needed.

Terminal and navigation

Toggle the integrated terminal with Ctrl+` on both platforms, jump to a definition with F12, and rename a symbol everywhere with F2. Alt+Left / ⌃- navigates back to where your cursor just was.

FAQ

What is the Command Palette shortcut in VS Code?

Ctrl+Shift+P on Windows/Linux and ⌘⇧P on a Mac. It runs any command by name; press ⌘P / Ctrl+P (no Shift) to open files instead.

How do I select all occurrences of a word in VS Code?

Press Ctrl+D (⌘D on Mac) to add the next occurrence to your selection one at a time, or Ctrl+Shift+L (⇧⌘L) to select all occurrences at once.

How do I open the integrated terminal?

Press Ctrl+` (Control plus backtick) on both Windows and Mac to toggle the integrated terminal.

How do I comment out a line in VS Code?

Ctrl+/ on Windows/Linux and ⌘/ on a Mac toggles a line comment. Shift+Alt+A / ⇧⌥A wraps a block comment.

How do I move or duplicate a line in VS Code?

Alt+Up/Down (⌥Up/Down on Mac) moves the current line; add Shift (Shift+Alt+Up/Down or ⇧⌥Up/Down) to duplicate it.