VS Code Keyboard Shortcuts ⌘

In the past few years I've been using VS Code (over Vim) more and more for web development. One of it's strong points is how customizable and extendable it is, but also how you can use the keyboard for pretty much everything. Although I am usually very particular about defining my own shortcuts and macros, I find the VS Code defaults suitably adequate.

Below is a reference of Visual Studio Codes default keyboard shortcuts. This list is for Windows and Linux, as Mac OS has some slight differences, but most for shortcuts you can just replace Ctrl with ⌘.

General

  • Open File Finder: Ctrl + P
  • Command prompt: Ctrl + ⇧ + P
  • Toggle side bar: Ctrl + KB
  • Open Intelisense / Code Completion: Ctrl + Space
  • Open Terminal: Ctrl + '
  • Zen Mode, hides everything but the code: Ctrl + K + Z
  • View and Edit all Shortcuts: Ctrl + K + S

Editing

  • Cut line: Ctrl + X
  • Insert line bellow: Ctrl + ↩
  • Insert line above: Ctrl + ⇧ + ↩
  • Move line/selection up: Alt + ↑
  • Move line/selection down: Alt + ↓
  • Select word - Repeat select others occurrences: Ctrl + D
  • Delete Line: Ctrl + ⇧ + K
  • Indent current line(s): Ctrl + ]
  • Un-indent current line(s): Ctrl + [
  • Duplicate line(s) up/down: Alt + ⇧ + ↑/↓
  • Go to the begining of line: Home
  • Go to the end of line: End
  • Scroll line up: Ctrl + ↑
  • Scroll line down: Ctrl + ↓
  • Go to the begining of file: Ctrl + Home
  • Go to the end of file: Ctrl + End
  • Collapse region: Ctrl + ⇧ + [
  • Uncollapse region: Ctrl + ⇧ + ]
  • Collapse all regions: Ctrl + K Ctrl + 0
  • Uncoollapse all regions: Ctrl + K Ctrl + J
  • Toggle line comment: Ctrl + /
  • Toggle word wrap: Alt + Z

Navigation/Goto Anywhere

  • Goto line in current file: Ctrl + G
  • Quick-open files by name: Ctrl + P
  • Goto symbol: Ctrl + ⇧ + O
  • Show Problems panel: Ctrl + ⇧ + M
  • Go to next error warning: F8
  • Go to previous error warning: ⇧ + F8
  • Navigate editor group history: Ctrl + ⇧ + Tab
  • Go back / forward: Alt + ← / →

Find/Replace

  • Find: Ctrl + F
  • Replace: Ctrl + H
  • Find next / previous: F3 / ⇧ + F3
  • Select all occurrences of Find match: Alt + ↩
  • Find in files: Ctrl + ⇧ + F
  • Add selection to the next Find match: Ctrl + D

Multi-cursor and selection

  • Insert cursor: Alt + Click
  • Undo last cursor operation: Ctrl + U
  • Insert cursor at end of each line selected: ⇧ + Alt + I
  • Select current line: Ctrl + I
  • Select all occurrences of current selection: Ctrl + ⇧ + L
  • Select all occurrences of current word: Ctrl + F2
  • Expand selection: ⇧ + Alt + →
  • Shrink selection: ⇧ + Alt + ←
  • Column (box) selection: ⇧ + Alt + (drag mouse)

Rich languages editing

  • Trigger suggestion: Ctrl + Space
  • Trigger parameter hints: Ctrl + ⇧ + Space
  • Format document: ⇧ + Alt + F
  • Format selection: Ctrl + K Ctrl + F
  • Go to definition: F12
  • Peek definition: Alt + F12
  • Open Definition to the side: Ctrl + K F12
  • Trim trailing whitespace: Ctrl + K Ctrl + X
  • Change file language: Ctrl + K M

Editor management

  • Close editor: Ctrl + F4
  • Close folder: Ctrl + K F
  • Split editor in 1 / 2 / 3 parts: Ctrl + 1 / 2 / 3
  • Split view into two columns: Alt + ⇧ + 2
  • Revert view to single column: Alt + ⇧ + 1
  • Move editor left/right: Ctrl + ⇧ + PgUp / PgDn
  • Toggle editor layout (horizontal/vertical): ⇧ + Alt + 0

File management

  • New file: Ctrl + N
  • Open file...: Ctrl + O
  • Close current tab: Ctrl + W
  • Save: Ctrl + S
  • Save as...: Ctrl + ⇧ + S
  • Save all: Ctrl + K S
  • Reopen closed editor: Ctrl + ⇧ + T
  • Toggle tabs: Ctrl + Tab
  • Switch to tab number [NUM] where [NUM] <= number of tabs: Alt + [NUM]
  • Reveal active file in Explorer: Ctrl + K R
  • Show active file in new window/instance: Ctrl + K O
  • Rename file, variable or reference: F2

Display

  • Toggle full screen: F11
  • Zoom in/out: Ctrl + =/-
  • Toggle Sidebar visibility: Ctrl + B
  • Show Explorer / Toggle focus: Ctrl + ⇧ + E
  • Show Search: Ctrl + ⇧ + F
  • Show Source Control: Ctrl + ⇧ + G
  • Show Debug: Ctrl + ⇧ + D
  • Show Extensions: Ctrl + ⇧ + E
  • Replace in files: Ctrl + ⇧ + H
  • Toggle Search details: Ctrl + ⇧ + J
  • Toggle Output panel: Ctrl + ⇧ + U
  • Open Markdown preview: Ctrl + ⇧ + V
  • Open Markdown preview to the side: Ctrl + K V
  • Zen Mode (Esc Esc to exit): Ctrl + K Z

Debug

  • Toggle breakpoint: F9
  • Start/Continue: F5
  • Stop: ⇧ + F5
  • Step into/out: F11 / ⇧ + F11
  • Step over: F10
  • Show hover: Ctrl + K Ctrl + I

Integrated terminal

  • Show integrated terminal: Ctrl +
  • Create new terminal: Ctrl + ⇧ +
  • Copy selection: Ctrl + C
  • Paste into active terminal: Ctrl + V
  • Scroll up/down: Ctrl + ↑ / ↓
  • Scroll page up/down: ⇧ + PgUp / PgDn
  • Scroll to top/bottom: Ctrl + Home / End