Most work in Visual Studio Code can be done without reaching for the mouse: opening files, editing several lines at once, searching a whole project, running commands, and controlling the integrated terminal. If you learn only one shortcut, make it Ctrl+Shift+P on Windows and Linux or Command+Shift+P on macOS. That opens the Command Palette, which contains nearly every command VS Code offers.
Quick Answer
Start with five shortcuts. Use Ctrl+Shift+P or Command+Shift+P for the Command Palette, and Ctrl+P or Command+P to open a file. Search the project with Ctrl+Shift+F or Command+Shift+F. For the terminal, press Ctrl+`. And when you need the next matching occurrence, use Ctrl+D or Command+D.
| Action | Windows/Linux | macOS |
|---|---|---|
| Open Command Palette | Ctrl+Shift+P | Command+Shift+P |
| Quick Open file | Ctrl+P | Command+P |
| Search across files | Ctrl+Shift+F | Command+Shift+F |
| Toggle integrated terminal | Ctrl+` | Ctrl+` |
| Open keyboard shortcuts | Ctrl+K Ctrl+S | Command+K Command+S |
Reading VS Code Shortcut Chords
A few Visual Studio Code shortcuts are chords, meaning you press two key combinations one after the other. With Ctrl+K Ctrl+S, for instance, press Ctrl+K, let go, then press Ctrl+S. Don’t hold down every key at the same time.
File and Editor Shortcuts
| Action | Windows/Linux | macOS |
|---|---|---|
| New file | Ctrl+N | Command+N |
| Open file | Ctrl+O | Command+O |
| Save | Ctrl+S | Command+S |
| Close active editor | Ctrl+W | Command+W |
| Reopen closed editor | Ctrl+Shift+T | Command+Shift+T |
| Switch to next editor | Ctrl+PageDown | Option+Command+Right |
| Split editor | Ctrl+\ | Command+\ |
Editing and Multi-Cursor Shortcuts
Multi-cursor editing comes in handy when you’re renaming repeated values or adding identical text to several lines. It saves a lot of repetitive typing.
| Action | Windows/Linux | macOS |
|---|---|---|
| Select next matching occurrence | Ctrl+D | Command+D |
| Select all matching occurrences | Ctrl+Shift+L | Command+Shift+L |
| Insert cursor with mouse | Alt+Click | Option+Click |
| Add cursor above or below | Ctrl+Alt+Up/Down | Option+Command+Up/Down |
| Move line up or down | Alt+Up/Down | Option+Up/Down |
| Copy line up or down | Shift+Alt+Up/Down | Shift+Option+Up/Down |
| Delete current line | Ctrl+Shift+K | Shift+Command+K |
| Toggle line comment | Ctrl+/ | Command+/ |
| Toggle block comment | Shift+Alt+A | Shift+Option+A |
| Format document | Shift+Alt+F | Shift+Option+F |
| Rename symbol | F2 | F2 |
Search and Code Jump Shortcuts
| Action | Windows/Linux | macOS |
|---|---|---|
| Go to line | Ctrl+G | Ctrl+G |
| Go to symbol in file | Ctrl+Shift+O | Command+Shift+O |
| Go to definition | F12 | F12 |
| Peek definition | Alt+F12 | Option+F12 |
| Find in current file | Ctrl+F | Command+F |
| Replace in current file | Ctrl+H | Option+Command+F |
| Search across workspace | Ctrl+Shift+F | Command+Shift+F |
| Show Problems panel | Ctrl+Shift+M | Command+Shift+M |
Interface and Terminal Shortcuts
| Action | Windows/Linux | macOS |
|---|---|---|
| Show Explorer | Ctrl+Shift+E | Command+Shift+E |
| Show Extensions | Ctrl+Shift+X | Command+Shift+X |
| Toggle primary sidebar | Ctrl+B | Command+B |
| Toggle bottom panel | Ctrl+J | Command+J |
| Toggle terminal | Ctrl+` | Ctrl+` |
| Enter Zen Mode | Ctrl+K Z | Command+K Z |
| Open Settings | Ctrl+, | Command+, |
Debugging Shortcuts
| Action | Shortcut |
|---|---|
| Start or continue debugging | F5 |
| Stop debugging | Shift+F5 |
| Step over | F10 |
| Step into | F11 |
| Step out | Shift+F11 |
| Toggle breakpoint | F9 |
Changing Visual Studio Code Keyboard Shortcuts
- Open the shortcut editor with
Ctrl+K Ctrl+Son Windows/Linux orCommand+K Command+Son macOS. - Search for the command you want to change.
- Select the pencil icon next to that command.
- Press your new key combination, then confirm it with Enter.
- Check any warning that says the combination is already assigned.
If you want to inspect the underlying configuration, open the Command Palette and run Preferences: Open Keyboard Shortcuts (JSON). A custom binding looks like this:
[
{
"key": "ctrl+alt+t",
"command": "workbench.action.terminal.toggleTerminal"
}
]Common Shortcut Problems
- The operating system captures the keys. Linux desktop environments may reserve combinations such as
Ctrl+Alt+Arrow. - An extension overrides the binding. Search for the key combination in the Keyboard Shortcuts editor to find conflicts.
- Function keys control hardware. Some laptops require
Fn+F12instead ofF12by itself. - The keyboard layout is different. On non-US keyboards, symbols such as the backtick may sit in another location.
- The chord is entered incorrectly. Release the first combination before pressing the second.
Shortcuts to Learn First
Don’t try to memorize the whole cheat sheet at once. Begin with Ctrl/Command+P, Ctrl/Command+Shift+P, Ctrl/Command+D, project search, and the terminal shortcut. Once those feel automatic, add the code-jumping and debugging commands.