VS Code Shortcuts

Essential Visual Studio Code keyboard shortcuts for Windows/Linux and macOS, the command palette, editing, multi-cursor selection, navigation, and search and refactor.

The Visual Studio Code shortcuts worth committing to memory, with Windows/Linux and macOS keys side by side. If you only learn one, make it the Command Palette (Ctrl/Cmd+Shift+P), it can run every command and shows the shortcut next to each.

Command & files

ActionWindows / LinuxMac
Command Palette Ctrl+Shift+P Cmd+Shift+P
Quick Open file Ctrl+P Cmd+P
New / close file Ctrl+N / Ctrl+W Cmd+N / Cmd+W
Save / Save all Ctrl+S / Ctrl+K S Cmd+S / Cmd+Option+S
Reopen closed editor Ctrl+Shift+T Cmd+Shift+T
Toggle sidebar Ctrl+B Cmd+B
Toggle terminal Ctrl+` Ctrl+`

Editing

ActionWindows / LinuxMac
Copy / cut line (no selection) Ctrl+C / Ctrl+X Cmd+C / Cmd+X
Move line up / down Alt+Up / Alt+Down Option+Up / Option+Down
Copy line up / down Shift+Alt+Up / Down Shift+Option+Up / Down
Delete line Ctrl+Shift+K Cmd+Shift+K
Insert line below / above Ctrl+Enter / Ctrl+Shift+Enter Cmd+Enter / Cmd+Shift+Enter
Toggle line comment Ctrl+/ Cmd+/
Indent / outdent Ctrl+] / Ctrl+[ Cmd+] / Cmd+[

Multi-cursor & selection

ActionWindows / LinuxMac
Add cursor Alt+Click Option+Click
Add cursor above / below Ctrl+Alt+Up / Down Cmd+Option+Up / Down
Select next match Ctrl+D Cmd+D
Select all matches Ctrl+Shift+L Cmd+Shift+L
Expand / shrink selection Shift+Alt+Right / Left Ctrl+Shift+Right / Left
Select current line Ctrl+L Cmd+L

Navigation

ActionWindows / LinuxMac
Go to line Ctrl+G Ctrl+G
Go to symbol Ctrl+Shift+O Cmd+Shift+O
Go to definition F12 F12
Peek definition Alt+F12 Option+F12
Go back / forward Alt+Left / Alt+Right Ctrl+Minus / Ctrl+Shift+Minus
Switch editor tab Ctrl+Tab Cmd+Tab in window

Search & refactor

ActionWindows / LinuxMac
Find / Replace Ctrl+F / Ctrl+H Cmd+F / Cmd+Option+F
Search across files Ctrl+Shift+F Cmd+Shift+F
Rename symbol F2 F2
Format document Shift+Alt+F Shift+Option+F
Quick fix Ctrl+. Cmd+.
Trigger suggestions Ctrl+Space Ctrl+Space

Some shortcuts are chords, press the first combo, release, then press the next (for example Ctrl+K then S). Open Preferences: Keyboard Shortcuts from the Command Palette to search and rebind any of these to your liking.

What this does

A VS Code shortcuts reference lists essential keyboard shortcuts for Windows/Linux and macOS — the command palette, editing, multi-cursor, navigation, and search.

How to use it

  1. Browse by task.
  2. Find the keys for your OS.
  3. Copy the shortcut with one tap.
  4. Try it in the editor.

Example

Ctrl/Cmd+Shift+P opens the Command Palette.

Sources & methodology

Last updated .

Frequently asked questions

What is the single most useful shortcut?

The Command Palette (Ctrl/Cmd+Shift+P). It can run any command and shows the keyboard shortcut next to each one, so you learn the rest as you go.

How do I edit multiple lines at once?

Add cursors with Alt/Option+Click, or select the next occurrence of the current word with Ctrl/Cmd+D and type to change them all together.

Can I change these shortcuts?

Yes. Open "Preferences: Keyboard Shortcuts" from the Command Palette to search, view, and rebind any shortcut.