VS Code Shortcuts

The keyboard shortcuts that save me hours every week. Multi-cursor, refactoring, and navigation.

Multi-Cursor

Add the next occurrence of the current selection to a new cursor. Keep pressing to grab more matches one at a time:

Ctrl+D          (Windows/Linux)
Cmd+D           (Mac)

Select all occurrences of the current selection at once — useful for bulk renaming a variable within a block:

Ctrl+Shift+L    (Windows/Linux)
Cmd+Shift+L     (Mac)

Place a cursor anywhere you click. Hold the modifier and click each spot where you need a cursor:

Alt+Click       (Windows/Linux)
Option+Click    (Mac)

Column (box) select — drag to create cursors on consecutive lines. Perfect for editing aligned code like CSV data or repeated assignments:

Shift+Alt+Drag          (Windows/Linux)
Shift+Option+Drag       (Mac)

# Keyboard-only alternative: add cursor above/below
Ctrl+Alt+Up/Down        (Windows/Linux)
Cmd+Option+Up/Down      (Mac)

Undo the last cursor addition if you accidentally grabbed the wrong match:

Ctrl+U          (Windows/Linux)
Cmd+U           (Mac)

Editing

Move the current line (or selection) up or down. Indentation adjusts automatically:

Alt+Up          (Windows/Linux) — move line up
Alt+Down        (Windows/Linux) — move line down
Option+Up       (Mac)
Option+Down     (Mac)

Copy the current line up or down without cutting it:

Shift+Alt+Up    (Windows/Linux) — duplicate line up
Shift+Alt+Down  (Windows/Linux) — duplicate line down
Shift+Option+Up/Down  (Mac)

Delete the entire current line — no need to select it first:

Ctrl+Shift+K    (Windows/Linux)
Cmd+Shift+K     (Mac)

Toggle line comment. Works on single lines or multi-line selections:

Ctrl+/          (Windows/Linux) — line comment
Cmd+/           (Mac)

Shift+Alt+A     (Windows/Linux) — block comment
Shift+Option+A  (Mac)

Fold and unfold code blocks to focus on the structure you care about:

Ctrl+Shift+[    (Windows/Linux) — fold region
Ctrl+Shift+]    (Windows/Linux) — unfold region
Cmd+Option+[    (Mac)
Cmd+Option+]    (Mac)

Ctrl+K Ctrl+0   — fold all regions
Ctrl+K Ctrl+J   — unfold all regions

Indent or outdent lines manually:

Ctrl+]          (Windows/Linux) — indent line
Ctrl+[          (Windows/Linux) — outdent line
Cmd+]           (Mac)
Cmd+[           (Mac)

Refactoring

Rename a symbol across the entire project. Works for variables, functions, classes, and imports:

F2              (Windows/Linux/Mac)

# Place cursor on the symbol name, press F2,
# type the new name, press Enter.
# All references update automatically.

Quick Fix / Code Actions — the lightbulb menu. Shows context-aware suggestions like auto-imports, type fixes, and refactoring options:

Ctrl+.          (Windows/Linux)
Cmd+.           (Mac)

# Common quick fixes:
# - Add missing import
# - Convert to optional chain
# - Fix spelling in identifiers
# - Implement interface methods

Extract selection to a new function or variable. Select the code you want to extract first:

# Select code, then use Quick Fix:
Ctrl+.          (Windows/Linux)
Cmd+.           (Mac)

# Choose from the menu:
# - "Extract to function in module scope"
# - "Extract to constant in enclosing scope"
# - "Extract to method in class"

Organize imports — removes unused imports and sorts the rest alphabetically:

Shift+Alt+O     (Windows/Linux)
Shift+Option+O  (Mac)

# To auto-organize on save, add to settings.json:
# "editor.codeActionsOnSave": {
#     "source.organizeImports": "explicit"
# }

Peek and Go to Definition — explore code without leaving your current file:

F12             — Go to Definition
Alt+F12         — Peek Definition (inline preview)
Shift+F12       — Find All References

Terminal & Panels

Toggle the integrated terminal. Keeps your workflow in one window:

Ctrl+`          (Windows/Linux)
Cmd+`           (Mac)

# Create a new terminal instance
Ctrl+Shift+`    (Windows/Linux)
Cmd+Shift+`     (Mac)

Split the editor to view two files side by side:

Ctrl+\          (Windows/Linux)
Cmd+\           (Mac)

# Move focus between split panes
Ctrl+1, Ctrl+2, Ctrl+3  (Windows/Linux)
Cmd+1, Cmd+2, Cmd+3     (Mac)

Toggle the sidebar on and off to reclaim screen space:

Ctrl+B          (Windows/Linux)
Cmd+B           (Mac)

Toggle the bottom panel (where terminal, problems, and output live):

Ctrl+J          (Windows/Linux)
Cmd+J           (Mac)

Jump directly to specific sidebar views:

Ctrl+Shift+E    (Windows/Linux) — Explorer
Ctrl+Shift+F    (Windows/Linux) — Search
Ctrl+Shift+G    (Windows/Linux) — Source Control
Ctrl+Shift+D    (Windows/Linux) — Debug
Ctrl+Shift+X    (Windows/Linux) — Extensions

# Mac: replace Ctrl with Cmd

Zen Mode removes all UI chrome for distraction-free editing:

Ctrl+K Z        (Windows/Linux) — toggle Zen Mode
Cmd+K Z         (Mac)

# Press Escape twice to exit Zen Mode