Visual Studio Code Keyboard Shortcuts Cheat Sheet for Windows, macOS, and Linux

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.

ActionWindows/LinuxmacOS
Open Command PaletteCtrl+Shift+PCommand+Shift+P
Quick Open fileCtrl+PCommand+P
Search across filesCtrl+Shift+FCommand+Shift+F
Toggle integrated terminalCtrl+`Ctrl+`
Open keyboard shortcutsCtrl+K Ctrl+SCommand+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

ActionWindows/LinuxmacOS
New fileCtrl+NCommand+N
Open fileCtrl+OCommand+O
SaveCtrl+SCommand+S
Close active editorCtrl+WCommand+W
Reopen closed editorCtrl+Shift+TCommand+Shift+T
Switch to next editorCtrl+PageDownOption+Command+Right
Split editorCtrl+\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.

ActionWindows/LinuxmacOS
Select next matching occurrenceCtrl+DCommand+D
Select all matching occurrencesCtrl+Shift+LCommand+Shift+L
Insert cursor with mouseAlt+ClickOption+Click
Add cursor above or belowCtrl+Alt+Up/DownOption+Command+Up/Down
Move line up or downAlt+Up/DownOption+Up/Down
Copy line up or downShift+Alt+Up/DownShift+Option+Up/Down
Delete current lineCtrl+Shift+KShift+Command+K
Toggle line commentCtrl+/Command+/
Toggle block commentShift+Alt+AShift+Option+A
Format documentShift+Alt+FShift+Option+F
Rename symbolF2F2

Search and Code Jump Shortcuts

ActionWindows/LinuxmacOS
Go to lineCtrl+GCtrl+G
Go to symbol in fileCtrl+Shift+OCommand+Shift+O
Go to definitionF12F12
Peek definitionAlt+F12Option+F12
Find in current fileCtrl+FCommand+F
Replace in current fileCtrl+HOption+Command+F
Search across workspaceCtrl+Shift+FCommand+Shift+F
Show Problems panelCtrl+Shift+MCommand+Shift+M

Interface and Terminal Shortcuts

ActionWindows/LinuxmacOS
Show ExplorerCtrl+Shift+ECommand+Shift+E
Show ExtensionsCtrl+Shift+XCommand+Shift+X
Toggle primary sidebarCtrl+BCommand+B
Toggle bottom panelCtrl+JCommand+J
Toggle terminalCtrl+`Ctrl+`
Enter Zen ModeCtrl+K ZCommand+K Z
Open SettingsCtrl+,Command+,

Debugging Shortcuts

ActionShortcut
Start or continue debuggingF5
Stop debuggingShift+F5
Step overF10
Step intoF11
Step outShift+F11
Toggle breakpointF9

Changing Visual Studio Code Keyboard Shortcuts

  1. Open the shortcut editor with Ctrl+K Ctrl+S on Windows/Linux or Command+K Command+S on macOS.
  2. Search for the command you want to change.
  3. Select the pencil icon next to that command.
  4. Press your new key combination, then confirm it with Enter.
  5. 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+F12 instead of F12 by 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.

Leave a Comment

Related Posts