Visual Studio Code keyboard shortcuts
Visual Studio Code keyboard shortcuts
84 shortcuts
Windows, macOS and Linux
Microsoft's code editor. Its macOS keymap is not a straight Ctrl to Command translation — Replace, Find Next, Go Back, Go to Line, Source Control and the integrated terminal all land on different keys, so check the note before assuming. Anything here can be rebound from the Keyboard Shortcuts editor, and installed extensions add more.
General
| Shortcut | What it does |
|---|---|
| Ctrl/⌘ + Shift + P | Open the Command Palette |
| Ctrl/⌘ + P | Quick-open a file by name |
| Ctrl/⌘ + Shift + N | Open a new window |
| Ctrl + Shift + W | Close the window — On macOS: ⌘ + W |
| Ctrl/⌘ + , | Open user settings |
| Ctrl/⌘ + K then Ctrl/⌘ + S | Open the Keyboard Shortcuts editor |
Basic editing
| Shortcut | What it does |
|---|---|
| Ctrl/⌘ + X | Cut the whole line when nothing is selected |
| Ctrl/⌘ + C | Copy the whole line when nothing is selected |
| Alt + Up / Down | Move the current line up or down — On macOS: ⌥ + ↑ / ↓ |
| Ctrl + Shift + K | Delete the current line — On macOS: ⇧ + ⌘ + K |
| Ctrl + Enter | Insert a line below — On macOS: ⌘ + Return |
| Ctrl + Shift + Enter | Insert a line above — On macOS: ⇧ + ⌘ + Return |
| Ctrl + Home | Go to the start of the file — On macOS: ⌘ + ↑ |
| Ctrl + End | Go to the end of the file — On macOS: ⌘ + ↓ |
| Ctrl + Up / Down | Scroll the view a line at a time — On macOS: ⌃ + Page Up / Page Down |
| Ctrl + Shift + [ | Fold the region at the cursor — On macOS: ⌥ + ⌘ + [ |
| Ctrl + Shift + ] | Unfold the region at the cursor — On macOS: ⌥ + ⌘ + ] |
| Ctrl/⌘ + / | Toggle a line comment |
| Shift + Alt + A | Toggle a block comment — On macOS: ⇧ + ⌥ + A |
| Alt + Z | Toggle word wrap — On macOS: ⌥ + Z |
| Ctrl/⌘ + Z | Undo the last edit |
| Ctrl + Y | Redo the last edit — On macOS: ⇧ + ⌘ + Z |
Multi-cursor and selection
| Shortcut | What it does |
|---|---|
| Alt + Click | Add another cursor — On macOS: ⌥ + Click |
| Ctrl + Alt + Up / Down | Add a cursor above or below — On macOS: ⌥ + ⌘ + ↑ / ↓ |
| Ctrl + U | Undo the last cursor operation — On macOS: ⌘ + U |
| Shift + Alt + I | Put a cursor at the end of every selected line — On macOS: ⇧ + ⌥ + I |
| Ctrl + L | Select the current line — On macOS: ⌘ + L |
| Ctrl + Shift + L | Select every occurrence of the selection — On macOS: ⇧ + ⌘ + L |
| Shift + Alt + Right | Expand the selection to the next syntax scope — On macOS: ⌃ + ⇧ + ⌘ + → |
| Shift + Alt + Left | Shrink the selection — On macOS: ⌃ + ⇧ + ⌘ + ← |
Navigation
| Shortcut | What it does |
|---|---|
| Ctrl/⌘ + T | Search every symbol in the workspace |
| Ctrl + G | Go to a line number — On macOS: ⌃ + G — Control, not ⌘ |
| Ctrl + Shift + O | Go to a symbol in the current file — On macOS: ⇧ + ⌘ + O |
| Ctrl + Shift + M | Show the Problems panel — On macOS: ⇧ + ⌘ + M |
| F8 | Jump to the next error or warning |
| Shift + F8 | Jump to the previous error or warning |
| Ctrl + Shift + Tab | Walk the editor history — On macOS: ⌃ + ⇧ + Tab — Control, not ⌘ |
| Alt + Left / Right | Go back or forward through your jumps — On macOS: ⌃ + - and ⌃ + ⇧ + - |
Search and replace
| Shortcut | What it does |
|---|---|
| Ctrl/⌘ + F | Find in the current file |
| Ctrl + H | Replace in the current file — On macOS: ⌥ + ⌘ + F |
| F3 / Shift + F3 | Go to the next or previous match — On macOS: ⌘ + G and ⇧ + ⌘ + G |
| Alt + Enter | Select every match of the current search — On macOS: ⌥ + Return |
| Ctrl/⌘ + D | Add the next match to the selection |
| Alt + C | Toggle case-sensitive matching — On macOS: ⌥ + ⌘ + C |
| Alt + R | Toggle regular expression matching — On macOS: ⌥ + ⌘ + R |
| Alt + W | Toggle whole-word matching — On macOS: ⌥ + ⌘ + W |
| Ctrl + Shift + F | Search across every file — On macOS: ⇧ + ⌘ + F |
| Ctrl + Shift + H | Replace across every file — On macOS: ⇧ + ⌘ + H |
Language features
| Shortcut | What it does |
|---|---|
| Ctrl + Space | Trigger a completion suggestion — On macOS: ⌃ + Space |
| Shift + Alt + F | Format the whole document — On macOS: ⇧ + ⌥ + F |
| Ctrl/⌘ + K then Ctrl/⌘ + F | Format just the selection |
| F12 | Go to the definition |
| Alt + F12 | Peek the definition inline — On macOS: ⌥ + F12 |
| Ctrl/⌘ + K then F12 | Open the definition in a side editor |
| Ctrl/⌘ + . | Show quick fixes for the problem at the cursor |
| Shift + F12 | Show every reference to the symbol |
| F2 | Rename the symbol everywhere |
Editor and file management
| Shortcut | What it does |
|---|---|
| Ctrl + W | Close the active editor — On macOS: ⌘ + W |
| Ctrl/⌘ + \ | Split the editor |
| Ctrl/⌘ + N | Create a new file |
| Ctrl/⌘ + O | Open a file |
| Ctrl/⌘ + S | Save the active file |
| Ctrl + Shift + S | Save the active file under a new name — On macOS: ⇧ + ⌘ + S |
| Ctrl + K then S | Save every open file — On macOS: ⌥ + ⌘ + S, with no K prefix |
| Ctrl + Shift + T | Reopen the last closed editor — On macOS: ⇧ + ⌘ + T |
| Ctrl + Tab | Cycle to the next editor — On macOS: ⌃ + Tab |
| F11 | Toggle full screen — On macOS: ⌃ + ⌘ + F |
| Shift + Alt + 0 | Flip the editor layout between rows and columns — On macOS: ⌥ + ⌘ + 0 |
| Ctrl + = / - | Zoom the whole interface in or out — On macOS: ⌘ + = and ⇧ + ⌘ + - |
| Ctrl/⌘ + B | Show or hide the sidebar |
| Ctrl + Shift + E | Show the Explorer — On macOS: ⇧ + ⌘ + E |
| Ctrl + Shift + G | Show Source Control — On macOS: ⌃ + ⇧ + G — Control, not ⌘ |
| Ctrl + Shift + X | Show the Extensions view — On macOS: ⇧ + ⌘ + X |
| Ctrl + K then Z | Enter Zen Mode — On macOS: ⌘ + K then ⌘ + Z |
Terminal and debugging
| Shortcut | What it does |
|---|---|
| Ctrl + ` | Show or hide the terminal — On macOS: ⌃ + ` — Control, not ⌘ |
| Ctrl + Shift + ` | Create a new terminal — On macOS: ⌃ + ⇧ + ` |
| Ctrl + Up / Down | Scroll the terminal a line at a time — On macOS: ⌘ + ↑ / ↓ |
| Shift + Page Up / Page Down | Scroll the terminal a page at a time — On macOS: Page Up / Page Down with no modifier |
| F9 | Toggle a breakpoint on the current line |
| F5 | Start or continue debugging |
| Shift + F5 | Stop debugging |
| F10 | Step over |
| F11 / Shift + F11 | Step into or step out |
| Ctrl + F5 | Run without debugging — On macOS: ⌃ + F5 |
Common questions
- How many keyboard shortcuts does Visual Studio Code have?
- This page lists 84 shortcuts across 8 groups, covering the ones people actually use day to day rather than every binding the application defines.
- Are Visual Studio Code shortcuts the same on Mac and Windows?
- Mostly. The usual difference is that Ctrl on Windows becomes ⌘ on macOS, which is why the shortcuts here are written as "Ctrl/⌘". Where a binding genuinely differs beyond that swap, it is spelled out separately.
Related pages
Sources
- Official vendor product documentation — At One Place