Why Keyboard Shortcuts Matter for Developers
VS Code keyboard shortcuts are one of the fastest ways to boost your coding productivity. Every time you reach for the mouse, you lose a few seconds -- and those seconds add up to hours over a week. Developers who master keyboard shortcuts in Visual Studio Code report completing tasks 30-50% faster than those who rely on menus and mouse clicks.
This guide covers the most impactful VS Code shortcuts for macOS and Windows/Linux, organized by workflow category. Whether you are editing code, navigating files, managing terminals, or debugging, these shortcuts will transform how you work.
Essential Navigation Shortcuts
Navigation is where you spend the most time. These shortcuts help you jump between files, symbols, and lines without touching the mouse.
File and Tab Navigation
| Action | macOS | Windows / Linux |
|---|
| Quick Open (file by name) | Cmd+P | Ctrl+P |
| Command Palette | Cmd+Shift+P | Ctrl+Shift+P |
| Switch between open tabs | Cmd+Tab / Ctrl+Tab | Ctrl+Tab |
| Go to specific tab | Cmd+1...9 | Ctrl+1...9 |
| Close current tab | Cmd+W | Ctrl+W |
| Reopen closed tab | Cmd+Shift+T | Ctrl+Shift+T |
| Toggle sidebar visibility | Cmd+B | Ctrl+B |
| Toggle terminal | Cmd+` | Ctrl+` |
| Open Explorer panel | Cmd+Shift+E | Ctrl+Shift+E |
| Open Search panel | Cmd+Shift+F | Ctrl+Shift+F |
| Open Source Control panel | Cmd+Shift+G | Ctrl+Shift+G |
| Open Extensions panel | Cmd+Shift+X | Ctrl+Shift+X |
Code Navigation
| Action | macOS | Windows / Linux |
|---|
| Go to line number | Ctrl+G | Ctrl+G |
| Go to symbol in file | Cmd+Shift+O | Ctrl+Shift+O |
| Go to symbol in workspace | Cmd+T | Ctrl+T |
| Go to definition | F12 | F12 |
| Peek definition (inline) | Option+F12 | Alt+F12 |
| Go to type definition | Cmd+Click | Ctrl+Click |
| Find all references | Shift+F12 | Shift+F12 |
| Go back / forward | Ctrl+- / Ctrl+Shift+- | Alt+Left / Alt+Right |
| Breadcrumb navigation | Cmd+Shift+. | Ctrl+Shift+. |
Editing Shortcuts That Save Hours
These editing shortcuts handle the tasks you repeat hundreds of times a day: moving lines, duplicating code, selecting text, and formatting.
Line Operations
| Action | macOS | Windows / Linux |
|---|
| Move line up / down | Option+Up / Down | Alt+Up / Down |
| Copy line up / down | Shift+Option+Up / Down | Shift+Alt+Up / Down |
| Delete entire line | Cmd+Shift+K | Ctrl+Shift+K |
| Insert line below | Cmd+Enter | Ctrl+Enter |
| Insert line above | Cmd+Shift+Enter | Ctrl+Shift+Enter |
| Indent line | Cmd+] | Ctrl+] |
| Outdent line | Cmd+[ | Ctrl+[ |
| Toggle line comment | Cmd+/ | Ctrl+/ |
| Toggle block comment | Shift+Option+A | Shift+Alt+A |
| Join lines | Ctrl+J | (custom binding) |
Selection and Multi-Cursor
Multi-cursor editing is one of VS Code's most powerful features. Once you master it, you will never want to edit text any other way.
| Action | macOS | Windows / Linux |
|---|
| Add cursor above / below | Cmd+Option+Up / Down | Ctrl+Alt+Up / Down |
| Add cursor at click position | Option+Click | Alt+Click |
| Select current word | Cmd+D | Ctrl+D |
| Select all occurrences of word | Cmd+Shift+L | Ctrl+Shift+L |
| Select current line | Cmd+L | Ctrl+L |
| Expand selection | Cmd+Shift+Right | Shift+Alt+Right |
| Shrink selection | Cmd+Shift+Left | Shift+Alt+Left |
| Column (box) selection | Shift+Option+Drag | Shift+Alt+Drag |
| Select all matching find results | Cmd+Shift+L after Cmd+F | Ctrl+Shift+L after Ctrl+F |
Multi-Cursor Workflow Example
Scenario: Rename a CSS class in multiple places at once
1. Place cursor on the class name
2. Press Cmd+D (Ctrl+D) repeatedly to select each occurrence
3. Type the new name -- all instances update simultaneously
Before:
<div class="old-card">
<h2 class="old-card-title">...</h2>
<p class="old-card-body">...</p>
</div>
After (typed "new-card" once):
<div class="new-card">
<h2 class="new-card-title">...</h2>
<p class="new-card-body">...</p>
</div>
Search and Replace
| Action | macOS | Windows / Linux |
|---|
| Find in file | Cmd+F | Ctrl+F |
| Replace in file | Cmd+Option+F | Ctrl+H |
| Find in workspace (all files) | Cmd+Shift+F | Ctrl+Shift+F |
| Replace in workspace | Cmd+Shift+H | Ctrl+Shift+H |
| Find next / previous match | Cmd+G / Cmd+Shift+G | F3 / Shift+F3 |
| Toggle regex in search | Cmd+Option+R | Alt+R |
| Toggle case-sensitive search | Cmd+Option+C | Alt+C |
| Toggle whole word match | Cmd+Option+W | Alt+W |
Regex Search Examples in VS Code
# Find all console.log statements
console\.log\(.*\)
# Find function declarations (JS/TS)
(function|const|let|var)\s+\w+\s*=\s*(async\s+)?\(
# Find TODO/FIXME comments
(TODO|FIXME|HACK|BUG):\s*.*
# Find imports from a specific module
import.*from\s+['"]@/components.*['"]
# Find empty HTML tags
<(\w+)[^>]*>\s*<\/\1>
# Replace: convert px to rem (capture group)
Find: (\d+)px
Replace: calc($1 / 16 * 1rem)
Code Intelligence and Refactoring
| Action | macOS | Windows / Linux |
|---|
| Trigger suggestions | Ctrl+Space | Ctrl+Space |
| Trigger parameter hints | Cmd+Shift+Space | Ctrl+Shift+Space |
| Quick Fix (lightbulb actions) | Cmd+. | Ctrl+. |
| Rename symbol | F2 | F2 |
| Format document | Shift+Option+F | Shift+Alt+F |
| Format selection | Cmd+K Cmd+F | Ctrl+K Ctrl+F |
| Organize imports | Shift+Option+O | Shift+Alt+O |
| Extract to function/variable | Cmd+. (select refactoring) | Ctrl+. (select refactoring) |
| Fold / unfold code block | Cmd+Option+[ / ] | Ctrl+Shift+[ / ] |
| Fold all / unfold all | Cmd+K Cmd+0 / Cmd+K Cmd+J | Ctrl+K Ctrl+0 / Ctrl+K Ctrl+J |
Terminal and Integrated Tools
| Action | macOS | Windows / Linux |
|---|
| Toggle integrated terminal | Cmd+` | Ctrl+` |
| Create new terminal | Cmd+Shift+` | Ctrl+Shift+` |
| Split terminal | Cmd+\ | Ctrl+\ |
| Switch terminal instance | Cmd+Shift+[ / ] | Ctrl+PageUp / PageDown |
| Clear terminal | Cmd+K | Ctrl+K |
| Kill terminal | Click trash icon or type exit | Click trash icon or type exit |
| Toggle problems panel | Cmd+Shift+M | Ctrl+Shift+M |
| Toggle output panel | Cmd+Shift+U | Ctrl+Shift+U |
Debugging Shortcuts
| Action | macOS | Windows / Linux |
|---|
| Start / continue debugging | F5 | F5 |
| Stop debugging | Shift+F5 | Shift+F5 |
| Restart debugging | Cmd+Shift+F5 | Ctrl+Shift+F5 |
| Step over | F10 | F10 |
| Step into | F11 | F11 |
| Step out | Shift+F11 | Shift+F11 |
| Toggle breakpoint | F9 | F9 |
| Conditional breakpoint | Right-click gutter | Right-click gutter |
| Inline breakpoint | Shift+F9 | Shift+F9 |
| Debug console | Cmd+Shift+Y | Ctrl+Shift+Y |
Git Integration Shortcuts
| Action | macOS | Windows / Linux |
|---|
| Open Source Control view | Cmd+Shift+G | Ctrl+Shift+G |
| Stage changes | Click + icon or Cmd+Shift+G then select | Click + icon |
| View diff of file | Click file in Source Control | Click file in Source Control |
| Open Git output | Cmd+Shift+U (select Git) | Ctrl+Shift+U (select Git) |
| Inline diff view toggle | From Command Palette | From Command Palette |
Window and Layout Management
| Action | macOS | Windows / Linux |
|---|
| Split editor right | Cmd+\ | Ctrl+\ |
| Split editor down | Cmd+K Cmd+\ | Ctrl+K Ctrl+\ |
| Focus editor group 1/2/3 | Cmd+1 / Cmd+2 / Cmd+3 | Ctrl+1 / Ctrl+2 / Ctrl+3 |
| Move editor to next group | Cmd+Option+Right | Ctrl+Alt+Right |
| Toggle full screen | Cmd+Ctrl+F | F11 |
| Toggle Zen Mode | Cmd+K Z | Ctrl+K Z |
| Zoom in / out | Cmd+= / Cmd+- | Ctrl+= / Ctrl+- |
| Toggle word wrap | Option+Z | Alt+Z |
| Toggle minimap | From Command Palette | From Command Palette |
Custom Keybindings
You can customize any shortcut via Cmd+K Cmd+S (Ctrl+K Ctrl+S on Windows/Linux), or edit the keybindings.json file directly. Here are some popular custom bindings:
// keybindings.json - Open via Cmd+K Cmd+S, then click the {} icon
[
// Duplicate line without clipboard (alternative)
{
"key": "cmd+shift+d",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus"
},
// Move between editor tabs
{
"key": "cmd+1",
"command": "workbench.action.openEditorAtIndex1"
},
// Toggle terminal with Cmd+J (common preference)
{
"key": "cmd+j",
"command": "workbench.action.togglePanel"
},
// Save all files
{
"key": "cmd+shift+s",
"command": "workbench.action.files.saveAll"
},
// Quick switch between recent files
{
"key": "cmd+e",
"command": "workbench.action.quickOpenRecent"
}
]
Productivity Tips and Workflows
Tip 1: The Quick Open Power Pattern
Cmd+P (Ctrl+P) supports special prefixes:
filename â Open file by name
:lineNumber â Go to line (e.g., :42)
@symbol â Go to symbol in file
@:category â Symbols grouped by category
#symbol â Go to symbol in workspace
>command â Run VS Code command
? â Show help for Quick Open
Example workflow:
1. Cmd+P â type "user" â opens UserComponent.tsx
2. Cmd+P â type ":125" â jumps to line 125
3. Cmd+P â type "@handleSubmit" â jumps to handleSubmit function
Tip 2: Emmet Abbreviations for HTML/CSS
VS Code has built-in Emmet support. Type abbreviations and press Tab:
HTML:
div.container>ul>li*5>a â nested structure with 5 list items
.card>.title+.body+.footer â div with three children
input:email â <input type="email">
link:css â <link rel="stylesheet">
! â full HTML5 boilerplate
CSS:
m10 â margin: 10px;
p20-30 â padding: 20px 30px;
df â display: flex;
jcc â justify-content: center;
aic â align-items: center;
bgc#333 â background-color: #333;
fz16 â font-size: 16px;
Tip 3: Snippets for Repetitive Code
// Open: Cmd+Shift+P â "Configure User Snippets"
// Select language (e.g., typescriptreact.json)
{
"React Functional Component": {
"prefix": "rfc",
"body": [
"interface ${1:Component}Props {",
" $2",
"}",
"",
"export default function ${1:Component}({ $3 }: ${1:Component}Props) {",
" return (",
" <div>",
" $0",
" </div>",
" );",
"}"
]
},
"useState Hook": {
"prefix": "ush",
"body": "const [$1, set${1/(.*)/${1:/capitalize}/}] = useState<$2>($3);"
},
"useEffect Hook": {
"prefix": "ueh",
"body": [
"useEffect(() => {",
" $1",
" return () => {",
" $2",
" };",
"}, [$3]);"
]
}
}
VS Code Settings for Maximum Productivity
// settings.json - Open via Cmd+, then click {} icon
{
// Auto-save files after delay
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000,
// Format on save and paste
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
// Smooth cursor animation
"editor.cursorSmoothCaretAnimation": "on",
"editor.cursorBlinking": "smooth",
// Bracket pair colorization (built-in)
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": "active",
// Sticky scroll (shows current scope)
"editor.stickyScroll.enabled": true,
// Minimap settings
"editor.minimap.enabled": true,
"editor.minimap.maxColumn": 80,
// Font and display
"editor.fontSize": 14,
"editor.lineHeight": 1.6,
"editor.fontLigatures": true,
// Terminal settings
"terminal.integrated.fontSize": 13,
"terminal.integrated.cursorStyle": "line"
}
Essential Extensions for Shortcut Power Users
| Extension | Purpose | Key Shortcut Added |
|---|
| Vim | Vim keybindings in VS Code | All Vim motions |
| GitLens | Git blame, history, comparisons | Various Git shortcuts |
| Bookmarks | Mark and jump between lines | Ctrl+Alt+K to toggle |
| Project Manager | Switch between projects quickly | Alt+Shift+P |
| Multi-Cursor Case Preserve | Preserves case during multi-cursor edits | Works with Cmd+D |
| IntelliCode | AI-assisted code completion | Enhances Ctrl+Space |
Printable Cheat Sheet Summary
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â VS CODE SHORTCUTS CHEAT SHEET â
â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââŁ
â â
â NAVIGATE EDIT â
â Cmd+P Quick Open Cmd+D Select word â
â Cmd+Shift+P Command Palette Option+Up Move line up â
â Ctrl+G Go to line Cmd+Shift+K Delete line â
â F12 Go to definition Cmd+/ Toggle comment â
â Cmd+Shift+O Go to symbol Shift+Option+F Format â
â â
â SEARCH MULTI-CURSOR â
â Cmd+F Find in file Cmd+D Add next match â
â Cmd+Shift+F Find in workspace Cmd+Shift+L All matches â
â Cmd+H Replace Option+Click Add cursor â
â Cmd+Option+Up Cursor above â
â â
â TERMINAL DEBUG â
â Cmd+` Toggle terminal F5 Start debugging â
â Cmd+Shift+` New terminal F9 Toggle breakpoint â
â Cmd+\ Split terminal F10 Step over â
â F11 Step into â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Conclusion
Mastering VS Code keyboard shortcuts is an investment that pays off every day. Start by learning five shortcuts this week, practice them until they become muscle memory, then add five more the next week. Within a month, you will navigate and edit code dramatically faster.
The most impactful shortcuts to learn first are: Cmd+P (Quick Open), Cmd+D (select next occurrence), Cmd+Shift+P (Command Palette), Option+Up/Down (move lines), and Cmd+/ (toggle comment). These five alone will transform your daily workflow.
Use our Diff Checker to compare code changes, or explore our Git Commands Cheat Sheet to complement your VS Code productivity.