# VS Code Keyboard Shortcuts Not Working
You press a familiar keyboard shortcut and... nothing happens. Or the wrong action executes. Standard shortcuts like Ctrl+S, Ctrl+P, or F5 don't work, or custom keybindings you configured are ignored. Keyboard shortcuts are the backbone of efficient VS Code usage, and when they break, your productivity drops dramatically.
Understanding Keybinding System
VS Code keyboard shortcuts work through:
- 1.Default keybindings (built-in)
- 2.User keybindings (keybindings.json)
- 3.Extension-contributed keybindings
- 4.Platform-specific overrides (Windows/macOS/Linux)
Keybindings can conflict, be overridden, or fail due to focus issues.
Step 1: Check Keyboard Shortcuts Editor
VS Code has a dedicated shortcuts editor:
Open shortcuts:
Ctrl+K Ctrl+S (or Cmd+K Cmd+S on macOS)
This shows all keybindings with: - Search functionality - Which command each key triggers - Conflicts indicated - Source (default, user, extension)
Search for problematic shortcut: Type the key combination or command name to find conflicts.
Step 2: Find Keybinding Conflicts
Multiple bindings for the same key cause confusion:
- 1.In shortcuts editor:
- 2.Type the key combination (e.g.,
ctrl+s) - 3.See all commands bound to that key
- 4.Check which one executes (first listed typically wins)
Check for duplicates:
``bash
# In keybindings.json, look for same key bound twice
Remove conflicting binding: Right-click binding → "Remove Keybinding"
Step 3: Check Extension Keybindings
Extensions often add their own shortcuts:
View extension keybindings: Shortcuts editor → Filter by "@ext:extension-id"
- 1.Disable extension keybindings:
- 2.If an extension's shortcuts interfere:
- 3.Extensions panel → Find extension
- 4.Settings → Look for keybinding settings
- 5.Or disable extension temporarily
Check for override: Extensions can override default bindings. Look for "When" conditions that might only apply in certain contexts.
Step 4: Fix Focus Issues
Shortcuts depend on what's focused:
Editor focus: Most editing shortcuts only work when text editor is focused, not when sidebar or terminal is active.
Terminal focus: When terminal is focused, VS Code shortcuts may not work (terminal receives keys directly).
Fix terminal shortcuts:
``json
{
"terminal.integrated.allowKeyboardShortcuts": true
}
Check current focus: Look at which panel has the colored border - that's where shortcuts apply.
Step 5: Handle Platform Differences
Shortcuts differ across platforms:
Windows/Linux: - Ctrl for most shortcuts - Alt for alternatives
macOS: - Cmd for most shortcuts (mapped from Ctrl) - Option for alternatives (mapped from Alt)
Check correct key:
Shortcuts editor shows platform-specific keys. A shortcut listed as Ctrl+S on Windows is Cmd+S on macOS.
Cross-platform keybindings.json:
``json
// Works across platforms
{
"key": "ctrl+s",
"command": "workbench.action.files.save"
}
// macOS automatically maps Ctrl to Cmd
Step 6: Fix User Keybindings
Custom keybindings in keybindings.json can break:
Open keybindings.json: Shortcuts editor → "Open Keyboard Shortcuts (JSON)" button
Check for errors: ```json // WRONG: Missing required field { "key": "ctrl+shift+f", // "command" missing - won't work }
// WRONG: Invalid key format { "key": "Ctrl Shift F", // Should be "ctrl+shift+f" "command": "editor.action.format" }
// CORRECT: { "key": "ctrl+shift+f", "command": "editor.action.formatDocument" } ```
Clear broken bindings: Remove malformed entries and reload window.
Step 7: Fix Context-Specific Shortcuts
Shortcuts may only work in certain contexts:
Check "When" condition:
In shortcuts editor, each binding shows when it applies:
``
editorTextFocus && !editorReadonly
This means the shortcut only works when: - Text editor is focused - File is not read-only
Add context to custom binding:
``json
{
"key": "ctrl+d",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus"
}
Common contexts:
- editorTextFocus - Text editor active
- terminalFocus - Terminal active
- filesExplorerFocus - File tree active
- searchViewletFocus - Search panel active
Step 8: Reset to Default Shortcuts
If everything is broken, reset:
Remove all custom bindings:
Delete keybindings.json content:
``json
[]
Or delete the file:
``bash
rm ~/.config/Code/User/keybindings.json # Linux
rm ~/Library/Application Support/Code/User/keybindings.json # macOS
Reload window:
Ctrl+Shift+P → "Developer: Reload Window"
All defaults restore.
Step 9: Handle International Keyboard Issues
Non-US keyboards may have key detection issues:
Use key codes:
Instead of key names, use key codes for reliability:
``json
{
"key": "[KeyY]",
"command": "editor.action.deleteLines"
}
Check keyboard layout: VS Code respects system keyboard layout. Ensure your layout matches expected keys.
Verification
Test shortcuts work:
- 1.Press
Ctrl+P(Quick Open) - should open file picker - 2.Press
Ctrl+S- should save file - 3.Press
F5- should start debugging - 4.Custom shortcuts should trigger expected commands
- 5.Shortcuts editor shows correct bindings without conflicts
Quick Reference
| Problem | Cause | Solution |
|---|---|---|
| Shortcut does nothing | Wrong focus | Ensure editor is focused |
| Wrong command runs | Conflict | Check shortcuts editor for duplicates |
| Custom binding ignored | Syntax error | Fix keybindings.json format |
| Extension shortcuts interfere | Override | Disable extension or remove binding |
| Mac shortcuts different | Platform mapping | Use Cmd instead of Ctrl on macOS |
| Context-specific not working | When condition | Add appropriate "when" clause |
Keyboard shortcut issues usually stem from conflicts or focus problems. Check the shortcuts editor for duplicates, verify the correct context, and fix any malformed custom keybindings.