πŸ“‹ Cheat Sheets

VS Code Keyboard Shortcuts Cheat Sheet β€” Mac & Windows


Click any shortcut to expand the explanation. Mac shortcuts listed first, Windows/Linux in parentheses.

✏️ Editing

⌘D / Ctrl+D β€” Select next occurrence multi-cursor
Select the next occurrence of the current selection. Press repeatedly to select more.
Mac:     ⌘D
Windows: Ctrl+D
Select a word, then press ⌘D repeatedly to select each next match. Edit them all at once. Skip one with ⌘K ⌘D / Ctrl+K Ctrl+D.
βŒ˜β‡§L / Ctrl+Shift+L β€” Select all occurrences multi-cursor
Select all occurrences of the current selection at once.
Mac:     βŒ˜β‡§L
Windows: Ctrl+Shift+L
Like ⌘D but selects every match in the file instantly. Great for renaming a variable everywhere.
βŒ₯Click / Alt+Click β€” Add cursor multi-cursor
Place multiple cursors anywhere in the file.
Mac:     βŒ₯ + Click
Windows: Alt + Click
Click at each position where you want a cursor, then type to edit all positions simultaneously.
βŒ₯⇧I / Alt+Shift+I β€” Cursors at line ends multi-cursor
Add a cursor at the end of each selected line.
Mac:     βŒ₯⇧I
Windows: Alt+Shift+I
Select multiple lines first, then press this to get a cursor at the end of each line. Perfect for adding semicolons or commas to multiple lines.
βŒ₯↑/↓ / Alt+↑/↓ β€” Move line up/down lines
Move the current line (or selection) up or down.
Mac:     βŒ₯↑ / βŒ₯↓
Windows: Alt+↑ / Alt+↓
No need to cut and paste β€” just move lines around directly.
βŒ₯⇧↑/↓ / Alt+Shift+↑/↓ β€” Copy line up/down lines
Duplicate the current line above or below.
Mac:     βŒ₯⇧↑ / βŒ₯⇧↓
Windows: Alt+Shift+↑ / Alt+Shift+↓
Fastest way to duplicate a line. Works with multi-line selections too.
βŒ˜β‡§K / Ctrl+Shift+K β€” Delete line lines
Delete the entire current line.
Mac:     βŒ˜β‡§K
Windows: Ctrl+Shift+K
No need to select the line first. Works with multiple cursors too.
⌘/ / Ctrl+/ β€” Toggle comment editing
Toggle line comment on the current line or selection.
Mac:     ⌘/
Windows: Ctrl+/

Block comment: Mac: βŒ₯⇧A Windows: Alt+Shift+A

Automatically uses the correct comment syntax for the current language.

⌘H / Ctrl+H β€” Find and replace find
Open find and replace in the current file.
Mac:     ⌘H
Windows: Ctrl+H

Find in files: Mac: βŒ˜β‡§H Windows: Ctrl+Shift+H

Enable the regex button (.*) for powerful pattern-based replacements. Use $1, $2 for capture groups.

🧭 Navigation

⌘P / Ctrl+P β€” Go to file essential
Quickly open any file by typing part of its name.
Mac:     ⌘P
Windows: Ctrl+P
The single most important shortcut. Type fuzzy matches like ucont to find UserController.ts. Add : followed by a line number to jump to that line.
βŒ˜β‡§P / Ctrl+Shift+P β€” Command palette essential
Access every VS Code command.
Mac:     βŒ˜β‡§P
Windows: Ctrl+Shift+P
Type any command: "format document", "change language", "toggle minimap", etc. If you forget any shortcut, find it here.
βŒ˜β‡§O / Ctrl+Shift+O β€” Go to symbol navigation
Jump to a function, class, or variable in the current file.
Mac:     βŒ˜β‡§O
Windows: Ctrl+Shift+O

Go to symbol in workspace: Mac: ⌘T Windows: Ctrl+T

Type : after opening to group symbols by kind (functions, classes, etc.).

⌘G / Ctrl+G β€” Go to line navigation
Jump to a specific line number.
Mac:     ⌘G
Windows: Ctrl+G
Type the line number and press Enter. Useful when following error stack traces.
F12 / F12 β€” Go to definition navigation
Jump to where a function, variable, or type is defined.
Go to definition:     F12
Peek definition:      βŒ₯F12 / Alt+F12
Go to references:     ⇧F12 / Shift+F12
Go to type definition: (right-click menu)
βŒ₯F12 (Peek) shows the definition inline without leaving your current file.
βŒƒ- / Alt+← β€” Go back navigation
Navigate back to your previous cursor position.
Go back:    βŒƒ- / Alt+←
Go forward: βŒƒβ‡§- / Alt+β†’
After jumping to a definition, press this to go back where you were. Works across files.
βŒ˜β‡§E / Ctrl+Shift+E β€” Explorer sidebar
Toggle the file explorer sidebar.
Explorer:     βŒ˜β‡§E / Ctrl+Shift+E
Search:       βŒ˜β‡§F / Ctrl+Shift+F
Source Control: βŒƒβ‡§G / Ctrl+Shift+G
Extensions:   βŒ˜β‡§X / Ctrl+Shift+X
Debug:        βŒ˜β‡§D / Ctrl+Shift+D

πŸ’» Terminal & Panels

βŒƒ` / Ctrl+` β€” Toggle terminal terminal
Show or hide the integrated terminal.
Toggle terminal:  βŒƒ` / Ctrl+`
New terminal:     βŒƒβ‡§` / Ctrl+Shift+`
Split terminal:   ⌘\ / Ctrl+\
You can have multiple terminals and switch between them.
⌘B / Ctrl+B β€” Toggle sidebar layout
Show or hide the sidebar to get more editor space.
Toggle sidebar:  ⌘B / Ctrl+B
Toggle panel:    ⌘J / Ctrl+J
Zen mode:        ⌘K Z / Ctrl+K Z
Zen mode hides everything except the editor β€” great for focused coding.

πŸ› Debugging

F5 β€” Start/continue debugging debug
Start debugging or continue to the next breakpoint.
Start/Continue:  F5
Stop:            ⇧F5 / Shift+F5
Restart:         βŒ˜β‡§F5 / Ctrl+Shift+F5
Step over:       F10
Step into:       F11
Step out:        ⇧F11 / Shift+F11
Toggle breakpoint: F9
Click in the gutter (left of line numbers) to set breakpoints, or press F9.

πŸ”€ Git Integration

Git shortcuts git
Built-in Git commands accessible from the command palette.
Source Control view: βŒƒβ‡§G / Ctrl+Shift+G

From Command Palette (βŒ˜β‡§P): Git: Commit Git: Push Git: Pull Git: Checkout to… Git: Create Branch

Click the + icon next to changed files to stage them. The inline diff viewer shows changes side by side.

⚑ Power User

βŒ˜β‡§V / Ctrl+Shift+V β€” Markdown preview productivity
Open a preview of the current Markdown file.
Preview:             βŒ˜β‡§V / Ctrl+Shift+V
Side-by-side preview: ⌘K V / Ctrl+K V
Side-by-side mode lets you edit and preview simultaneously.
⌘K ⌘S / Ctrl+K Ctrl+S β€” Keyboard shortcuts editor customization
Open the keyboard shortcuts editor to view and customize all shortcuts.
Mac:     ⌘K ⌘S
Windows: Ctrl+K Ctrl+S
Search for any command and assign your own keybinding. Click the record button to detect key combinations.
⌘, / Ctrl+, β€” Open settings customization
Open VS Code settings.
Settings UI:   ⌘, / Ctrl+,
Settings JSON: βŒ˜β‡§P β†’ "Open Settings (JSON)"
The JSON view gives you more control. Some settings are only available in JSON.

Quick Reference Table

ActionMacWindows/Linux
Open file⌘PCtrl+P
Command paletteβŒ˜β‡§PCtrl+Shift+P
Toggle terminalβŒƒ`Ctrl+`
Toggle sidebar⌘BCtrl+B
Go to definitionF12F12
Go backβŒƒ-Alt+←
Find & replace⌘HCtrl+H
Select next occurrence⌘DCtrl+D
Select all occurrencesβŒ˜β‡§LCtrl+Shift+L
Move line up/downβŒ₯↑/↓Alt+↑/↓
Duplicate lineβŒ₯⇧↑/↓Alt+Shift+↑/↓
Delete lineβŒ˜β‡§KCtrl+Shift+K
Toggle comment⌘/Ctrl+/
Go to symbolβŒ˜β‡§OCtrl+Shift+O
Start debuggingF5F5
Toggle breakpointF9F9