VSCode cheatsheet

Visual Studio Code Cheatsheet is here

Page content

Most frequently used commands in Visual Studio Code

paper notebooks

Visual Studio Code Cheatsheet

General Shortcuts (Windows / Mac)

Action Windows / Linux macOS
Command Palette Ctrl+Shift+P Cmd+Shift+P
Quick Open (File) Ctrl+P Cmd+P
Toggle Terminal Ctrl+` Ctrl+`
Toggle Sidebar Ctrl+B Cmd+B
Settings Ctrl+, Cmd+,
Open Keyboard Shortcuts Ctrl+K Ctrl+S Cmd+K Cmd+S
Show All Symbols Ctrl+T Cmd+T
Go to Line Ctrl+G Ctrl+G
Find Ctrl+F Cmd+F
Replace Ctrl+H Cmd+Option+F
Multi-cursor (add next) Ctrl+D Cmd+D
Multi-cursor (add above/below) Ctrl+Alt+Up/Down Option+Cmd+Up/Down
Move Line Up/Down Alt+Up/Down Option+Up/Down
Copy Line Up/Down Shift+Alt+Up/Down Shift+Option+Up/Down
Cut Line Ctrl+X Cmd+X
Copy Line Ctrl+C Cmd+C
Delete Line Ctrl+Shift+K Cmd+Shift+K
Comment Line Ctrl+/ Cmd+/
Format Document Shift+Alt+F Shift+Option+F
Save Ctrl+S Cmd+S
Close Editor Ctrl+W Cmd+W
Split Editor Ctrl+\ Cmd+\

Navigation

  • Go to Definition: F12
  • Peek Definition: Alt+F12
  • Go to References: Shift+F12
  • Go Back/Forward: Alt+Left/Right (Windows), Ctrl+–/Ctrl+Shift+– (Mac)

Editing

  • Duplicate Line: Shift+Alt+Down (Windows), Shift+Option+Down (Mac)
  • Move Line Up/Down: Alt+Up/Down (Windows), Option+Up/Down (Mac)
  • Select All Occurrences: Ctrl+Shift+L (Windows), Cmd+Ctrl+G (Mac)
  • Undo/Redo: Ctrl+Z / Ctrl+Y (Windows), Cmd+Z / Cmd+Shift+Z (Mac)

Integrated Terminal

  • New Terminal: Ctrl+Shift+` (Windows/Mac)
  • Toggle Terminal: Ctrl+` (Windows/Mac)
  • Kill Terminal: Ctrl+Shift+W

Source Control (Git)

  • Open Source Control: Ctrl+Shift+G (Windows), Cmd+Shift+G (Mac)
  • Commit: Ctrl+Enter (in commit message box)

Command Line Usage

# Open VS Code in current directory
code .

# Open specific file at line and column
code myfile.js:10:5

# Open diff view between two files
code --diff file1.js file2.js

# Open new VS Code window
code -n

# Disable all extensions
code --disable-extensions .

Customization

  • Change Theme: Ctrl+K Ctrl+T (Windows), Cmd+K Cmd+T (Mac)
  • Open Keyboard Shortcuts: Ctrl+K Ctrl+S (Windows), Cmd+K Cmd+S (Mac)
  • Install Extensions: Ctrl+Shift+X (Windows), Cmd+Shift+X (Mac)

Snippets

  • Create custom code snippets via Preferences: Configure User Snippets.

Tips

  • Use the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) for virtually any command or setting.
  • The .vscode folder in your project allows for workspace-specific settings and tasks.
  • You can install keymap extensions to use shortcuts from other editors (Vim, Sublime, etc.).

For a more comprehensive list, refer to the official [keyboard shortcuts PDF] or the in-editor shortcuts reference (Ctrl+K Ctrl+S).

How to Install a VS Code Extension from the Command Palette

You can install a Visual Studio Code extension directly from the Command Palette by following these steps:

  1. Open the Command Palette using Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS).
  2. Type Extensions: Install Extensions and select it from the list. This will open the Extensions view where you can search for and install extensions.
  3. Alternatively, you can type ext install (for example, ext install vscode-icons) directly into the Command Palette and press Enter. VS Code will prompt you for the extension name and install it if found.

This method allows you to quickly install extensions without leaving your keyboard or navigating through menus.

Other List of Editor Key Bindings

Ctrl+T (macOS: Cmd+T) - Show Workspace Symbols
Ctrl+Shift+O (macOS: Cmd+Shift+O) - Show Document Symbols
Ctrl+Shift+P (macOS: Cmd+Shift+P) - Open Command Palette
Ctrl+Space - Open Code Completion
Ctrl+. (macOS: Cmd+.) - Open Quick Fixes
F2 - Rename Symbol
Shift+Alt+F (macOS: Shift+Option+F) - Format Document
F12 - Go To Definition
Shift+F12 - Find References
Alt+Shift+O - Organize Directives
F4 - Show Type Hierarchy

Other List of Debug Key Bindings

Ctrl+Alt+D - Launch Dart DevTools
F5 - Start Debugging
Ctrl+F5 - Start Without Debugging
Shift+F5 - Stop Debugging
Ctrl+Shift+F5 (macOS: Cmd+Shift+F5) - Restart Debugging (or Hot Restart when debugging Flutter apps)
Ctrl+F5 - Hot Reload when debugging Flutter apps
F9 - Toggle Breakpoint
F10 - Step Over
F11 - Step In
Shift+F11 - Step Out