Tech News, Tech & Coding · Free Online Tools

IT Question Answer
Tools
Back to VS Code
VS Code Keyboard Shortcuts Guide

VS Code Keyboard Shortcuts Guide

VS CodeBy Muhammad Fareed
vs-codecodekeyboardshortcuts

Short answer: the most useful VS Code shortcut is the Command Palette (Ctrl+Shift+P, or Cmd+Shift+P on macOS), because it finds every command. Learn it first, then add the shortcuts below for the actions you repeat most.

Navigation

ActionWindows / LinuxmacOS
Command PaletteCtrl+Shift+PCmd+Shift+P
Quick open fileCtrl+PCmd+P
Go to lineCtrl+GCtrl+G
Go to symbol in fileCtrl+Shift+OCmd+Shift+O
Go to definitionF12F12
Peek definitionAlt+F12Option+F12
Toggle sidebarCtrl+BCmd+B
Toggle terminalCtrl+`Ctrl+`

Editing lines

ActionWindows / LinuxmacOS
Move line up or downAlt+Up/DownOption+Up/Down
Copy line downShift+Alt+DownShift+Option+Down
Delete lineCtrl+Shift+KCmd+Shift+K
Toggle line commentCtrl+/Cmd+/
Format documentShift+Alt+FShift+Option+F
Indent / outdentCtrl+] / Ctrl+[Cmd+] / Cmd+[

Multi-cursor and selection

Editing many places at once is the biggest time saver.

ActionWindows / LinuxmacOS
Select next occurrence of the wordCtrl+DCmd+D
Select all occurrencesCtrl+Shift+LCmd+Shift+L
Add cursor at clickAlt+ClickOption+Click
Add cursor above / belowCtrl+Alt+Up/DownCmd+Option+Up/Down
Expand selectionShift+Alt+RightCtrl+Shift+Cmd+Right

Example: place the cursor on a variable, press Ctrl+D three times to select three uses, and type the new name once.

Search and refactoring

ActionWindows / LinuxmacOS
Find in fileCtrl+FCmd+F
Replace in fileCtrl+HCmd+Option+F
Search across projectCtrl+Shift+FCmd+Shift+F
Rename symbolF2F2
Quick fixCtrl+.Cmd+.
Trigger suggestionsCtrl+SpaceCtrl+Space

Windows and layout

  • Split the editor: Ctrl+\ (Cmd+\ on macOS).
  • Close the current tab: Ctrl+W.
  • Switch between open tabs: Ctrl+Tab.
  • Zen mode (distraction-free): Ctrl+K Z.

Debugging

  • F5 start or continue, F9 toggle breakpoint.
  • F10 step over, F11 step into, Shift+F11 step out.

Full walkthrough: how to debug code in VS Code.

Customize your keys

Open the shortcut editor with Ctrl+K Ctrl+S, search a command and click the pencil icon to assign a new key. For advanced rules, edit keybindings.json:

[
  { "key": "ctrl+alt+t", "command": "workbench.action.terminal.toggleTerminal" }
]

How to learn them without overload

  1. Pick three shortcuts for actions you do every day.
  2. Use them for a week until they feel automatic.
  3. Add three more.

A printable summary is in the VS Code cheat sheet. Also see settings and customization.

Frequently asked questions

How do I see all keyboard shortcuts in VS Code?

Open the Keyboard Shortcuts editor with Ctrl+K Ctrl+S (Cmd+K Cmd+S on macOS). You can search every command, see its binding and change it.

Can I use Vim or Sublime Text shortcuts in VS Code?

Yes. Extensions such as Vim and Sublime Text Keymap bring familiar bindings, so you can keep your muscle memory while using VS Code features.

How can I remember so many shortcuts?

Learn two or three at a time, starting with the Command Palette, quick open and multi-cursor. Repeat them in real work for a week before adding more, and print a cheat sheet if it helps.

Why does a shortcut not work for me?

Another application, your operating system or a VS Code extension may use the same keys. Check the Keyboard Shortcuts editor for conflicts and, on some keyboard layouts, remap the binding.