ThisCalculator

Everyday

VS Code Keyboard Shortcuts: The Complete Guide

Updated · Standard formula, shown below

VS Code Keyboard Shortcuts: The Complete Guide

This guide covers the essential Visual Studio Code keyboard shortcuts for editing, navigation, and window management, plus how to customize them. You’ll learn the default keybindings that speed up daily coding, how to find and change any shortcut, and which ones matter most on Windows, macOS, and Linux.

Why Keyboard Shortcuts Matter in VS Code

Visual Studio Code is a free, open-source code editor from Microsoft, used by millions of developers. It’s built on Electron and supports hundreds of languages and extensions. Keyboard shortcuts reduce reliance on the mouse, which speeds up repetitive tasks like opening files, switching between tabs, and formatting code. The default shortcuts are consistent across platforms, but some keys differ (e.g., Ctrl vs. Cmd). Learning even 10–15 core shortcuts can noticeably improve your workflow.

Essential Editing Shortcuts

These are the shortcuts you’ll use every time you edit code:

  • Copy line up/down: Shift+Alt+Up/Down (Windows/Linux), Shift+Option+Up/Down (macOS) — duplicates the current line.
  • Move line up/down: Alt+Up/Down (Windows/Linux), Option+Up/Down (macOS) — reorders lines.
  • Delete line: Ctrl+Shift+K (Windows/Linux), Cmd+Shift+K (macOS).
  • Insert line above/below: Ctrl+Enter / Ctrl+Shift+Enter (Windows/Linux), Cmd+Enter / Cmd+Shift+Enter (macOS).
  • Comment line/block: Ctrl+/ (toggle line comment), Shift+Alt+A (toggle block comment) on Windows/Linux; Cmd+/ and Shift+Option+A on macOS.
  • Format document: Shift+Alt+F (Windows/Linux), Shift+Option+F (macOS) — applies the default formatter (e.g., Prettier).
  • Rename symbol: F2 — renames a variable/function across the file or workspace.

These shortcuts work in most language modes and respect your editor settings (like tab size and word wrap).

Navigation and Search Shortcuts

Moving around a large codebase is faster with these:

  • Quick Open file: Ctrl+P (Windows/Linux), Cmd+P (macOS) — type a filename to jump to it.
  • Go to line: Ctrl+G (Windows/Linux), Cmd+G (macOS) — type a line number.
  • Go to symbol: Ctrl+Shift+O (Windows/Linux), Cmd+Shift+O (macOS) — list symbols in the current file.
  • Find / Replace: Ctrl+F / Ctrl+H (Windows/Linux), Cmd+F / Cmd+H (macOS).
  • Search across files: Ctrl+Shift+F (Windows/Linux), Cmd+Shift+F (macOS) — opens the global search pane.
  • Go back / forward: Alt+Left/Right (Windows/Linux), Ctrl+Option+Left/Right (macOS) — jumps between cursor positions.

These shortcuts are especially useful when you have many open files or a large project.

Window and Panel Management

VS Code lets you split the editor and manage panels without touching the mouse:

  • New window: Ctrl+Shift+N (Windows/Linux), Cmd+Shift+N (macOS).
  • Close window: Ctrl+Shift+W (Windows/Linux), Cmd+Shift+W (macOS).
  • Split editor: Ctrl+\ (Windows/Linux), Cmd+\ (macOS) — splits the current editor vertically.
  • Switch between editors: Ctrl+1/2/3 (Windows/Linux), Cmd+1/2/3 (macOS) — jumps to a specific editor group.
  • Toggle terminal: Ctrl+` (backtick) on Windows/Linux, Cmd+` on macOS.
  • Toggle sidebar: Ctrl+B (Windows/Linux), Cmd+B (macOS) — shows/hides the activity bar and sidebar.
  • Zen mode: Ctrl+K Z (Windows/Linux), Cmd+K Z (macOS) — hides all UI except the editor.

These are great for reducing clutter and focusing on code.

Multi-Cursor and Selection Shortcuts

Multi-cursor editing is one of VS Code’s most powerful features:

  • Add cursor above/below: Ctrl+Alt+Up/Down (Windows/Linux), Cmd+Option+Up/Down (macOS).
  • Select all occurrences: Ctrl+Shift+L (Windows/Linux), Cmd+Shift+L (macOS) — selects every match of the current selection.
  • Add next occurrence: Ctrl+D (Windows/Linux), Cmd+D (macOS) — adds the next match to the current selection.
  • Column selection: Shift+Alt+drag (Windows/Linux), Shift+Option+drag (macOS) — selects a rectangular block.

These shortcuts let you edit multiple lines or repeated patterns at once, saving time on repetitive changes.

How to View and Customize Shortcuts

You can see every shortcut and change them to your liking:

  1. Open the Keyboard Shortcuts editor: press Ctrl+K Ctrl+S (Windows/Linux) or Cmd+K Cmd+S (macOS).
  2. Search by command name or keybinding.
  3. Click the pencil icon next to a command to add a new keybinding.
  4. Edit the keybindings.json file for advanced customizations (e.g., when clauses).

You can also install extensions that add new shortcuts, but be aware that they may conflict with existing ones. Use the Keyboard Shortcuts editor to detect conflicts (they appear with a warning triangle).

Common Problems and Misconceptions

One common issue is that shortcuts don’t work because of a conflicting extension or because the editor focus is in the terminal (which captures keys). Another is that macOS users often confuse Cmd and Ctrl — VS Code uses Cmd for most shortcuts, but some extensions use Ctrl. Also, the Ctrl+Alt+Up/Down shortcut may be overridden by the operating system’s display rotation on some Linux systems; you can disable that OS setting or change the VS Code keybinding.

Frequently Asked Questions

Q: How do I see all keyboard shortcuts in VS Code?
Press Ctrl+K Ctrl+S (or Cmd+K Cmd+S on macOS) to open the Keyboard Shortcuts editor. It lists all commands and their current keybindings, and you can search and filter them.

Q: Can I use VS Code shortcuts on a Mac?
Yes, but many shortcuts use Cmd instead of Ctrl. For example, copy line is Cmd+Shift+Down, and Quick Open is Cmd+P. The Keyboard Shortcuts editor shows both platform-specific bindings.

Q: Why is my shortcut not working?
Common causes: the terminal or an extension has focus, a conflicting keybinding, or the shortcut is disabled by a setting. Check the Keyboard Shortcuts editor for conflicts and try closing the terminal panel.

Q: How do I reset a shortcut to default?
In the Keyboard Shortcuts editor, right-click a command and choose “Reset Keybinding” to revert to the default.

Q: Are there shortcuts for specific extensions?
Yes, many extensions add their own shortcuts (e.g., GitLens, Prettier). You can view them in the Keyboard Shortcuts editor by searching the extension name.

Q: Can I create custom shortcuts for any action?
Yes, you can bind any command (including extension commands) to a key combination via the Keyboard Shortcuts editor or by editing keybindings.json.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.