`n

VS Code Productivity Shortcuts - Master Your Workflow

Published: September 25, 2024 | Reading time: 12 minutes

Essential Productivity Shortcuts

Master these shortcuts to dramatically increase your coding speed:

Top Shortcuts
Ctrl+Shift+P - Command Palette
Ctrl+P - Quick Open
Ctrl+D - Select Next Occurrence
Ctrl+Shift+L - Select All Occurrences
Alt+Click - Multi-cursor
Ctrl+Shift+K - Delete Line
Ctrl+/ - Toggle Comment

Navigation Shortcuts

File and Symbol Navigation

File Navigation

  • Ctrl+P - Quick Open files
  • Ctrl+Shift+P - Command Palette
  • Ctrl+G - Go to Line
  • Ctrl+Shift+O - Go to Symbol
  • Ctrl+T - Go to Symbol in Workspace
  • Ctrl+Shift+E - Explorer

Editor Navigation

  • Ctrl+Home/End - Start/End of file
  • Ctrl+Up/Down - Scroll line by line
  • Alt+Left/Right - Navigate back/forward
  • Ctrl+U - Undo cursor position
  • Ctrl+Shift+U - Redo cursor position
  • Ctrl+M - Toggle Tab moves focus

Editing Shortcuts

Text Manipulation

Essential Editing Shortcuts
// Line Operations
Ctrl+Shift+K - Delete Line
Alt+Up/Down - Move Line Up/Down
Shift+Alt+Up/Down - Copy Line Up/Down
Ctrl+Enter - Insert Line Below
Ctrl+Shift+Enter - Insert Line Above

// Word Operations
Ctrl+Left/Right - Move by Word
Ctrl+Shift+Left/Right - Select by Word
Ctrl+Backspace - Delete Word Left
Ctrl+Delete - Delete Word Right

Selection and Multi-cursor

Selection Techniques
// Basic Selection
Ctrl+D - Select Next Occurrence
Ctrl+Shift+L - Select All Occurrences
Ctrl+L - Select Current Line
Ctrl+Shift+I - Select Current Word

// Multi-cursor
Alt+Click - Add Cursor
Ctrl+Alt+Up/Down - Add Cursor Above/Below
Ctrl+U - Undo Last Cursor
Ctrl+Shift+U - Redo Last Cursor

Advanced Editing Techniques

Column Selection

Select rectangular blocks of text:

Column Selection
// Method 1: Mouse
Shift+Alt+Drag - Column selection

// Method 2: Keyboard
Shift+Alt+Click - Add column cursor
Shift+Alt+Up/Down - Extend column selection

// Example: Select all variable names
const firstName = "John";
const lastName = "Doe";
const email = "john@example.com";
// Select "firstName", "lastName", "email" simultaneously

Bracket and Quote Matching

Bracket Navigation
Ctrl+Shift+\ - Jump to Matching Bracket
Ctrl+Shift+[ - Fold Region
Ctrl+Shift+] - Unfold Region
Ctrl+K Ctrl+0 - Fold All Regions
Ctrl+K Ctrl+J - Unfold All Regions

Code Formatting and Comments

Formatting Shortcuts

Formatting Commands
// Formatting
Shift+Alt+F - Format Document
Ctrl+K Ctrl+F - Format Selection
Ctrl+Shift+I - Format Document (alternative)

// Comments
Ctrl+/ - Toggle Line Comment
Shift+Alt+A - Toggle Block Comment
Ctrl+K Ctrl+C - Add Line Comment
Ctrl+K Ctrl+U - Remove Line Comment

Search and Replace

Powerful Search Features

Search Shortcuts
// Basic Search
Ctrl+F - Find
Ctrl+H - Replace
F3 - Find Next
Shift+F3 - Find Previous

// Advanced Search
Ctrl+Shift+F - Find in Files
Ctrl+Shift+H - Replace in Files
Alt+C - Toggle Case Sensitive
Alt+R - Toggle Regex
Alt+W - Toggle Whole Word

Regex Search Examples

Common Regex Patterns
// Find all console.log statements
console\.log\(.*\)

// Find empty lines
^\s*$

// Find TODO comments
//\s*TODO.*$

// Find function declarations
function\s+\w+\s*\(

// Find unused imports (JavaScript)
^import.*from.*;\s*$

Git Integration Shortcuts

Version Control

Git Shortcuts
// Source Control
Ctrl+Shift+G - Source Control Panel
Ctrl+Enter - Commit Changes
Ctrl+Shift+P "Git: Push" - Push to Remote
Ctrl+Shift+P "Git: Pull" - Pull from Remote

// GitLens (if installed)
Alt+B - Toggle Blame Annotations
Alt+H - Toggle File History
Alt+L - Toggle Line History

Terminal and Debugging

Integrated Terminal

Terminal Shortcuts
// Terminal Control
Ctrl+` - Toggle Terminal
Ctrl+Shift+` - New Terminal
Ctrl+Shift+C - Copy Terminal Selection
Ctrl+Shift+V - Paste in Terminal
Ctrl+C - Interrupt Terminal Process

// Terminal Navigation
Ctrl+Up/Down - Scroll Terminal
Ctrl+Home/End - Terminal Start/End

Debugging Shortcuts

Debug Controls
// Debugging
F5 - Start Debugging
F9 - Toggle Breakpoint
F10 - Step Over
F11 - Step Into
Shift+F11 - Step Out
Shift+F5 - Stop Debugging
Ctrl+Shift+F5 - Restart Debugging

Workspace Management

Window and Panel Management

Window Shortcuts
// Panel Management
Ctrl+B - Toggle Sidebar
Ctrl+Shift+E - Explorer
Ctrl+Shift+F - Search
Ctrl+Shift+G - Source Control
Ctrl+Shift+D - Debug
Ctrl+Shift+X - Extensions

// Editor Management
Ctrl+\ - Split Editor
Ctrl+1/2/3 - Focus Editor Group
Ctrl+W - Close Editor
Ctrl+K W - Close All Editors
Ctrl+Shift+T - Reopen Closed Editor

Customizing Shortcuts

Creating Custom Keybindings

keybindings.json
[
  {
    "key": "ctrl+alt+r",
    "command": "workbench.action.reloadWindow",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+shift+alt+f",
    "command": "editor.action.formatDocument",
    "when": "editorHasDocumentFormattingProvider && editorTextFocus"
  },
  {
    "key": "ctrl+alt+l",
    "command": "editor.action.selectHighlights",
    "when": "editorFocus"
  }
]

Productivity Tips

Workflow Optimization

Speed Tips

  • Use Command Palette for everything
  • Master multi-cursor editing
  • Learn regex for search/replace
  • Use breadcrumbs for navigation
  • Customize your keybindings

Efficiency Tips

  • Use snippets for common patterns
  • Set up workspace-specific settings
  • Use IntelliSense effectively
  • Master the integrated terminal
  • Learn extension shortcuts

Platform-Specific Shortcuts

macOS vs Windows/Linux

Platform Differences
// macOS uses Cmd instead of Ctrl
Cmd+P - Quick Open (instead of Ctrl+P)
Cmd+Shift+P - Command Palette
Cmd+D - Select Next Occurrence
Cmd+Shift+L - Select All Occurrences

// Linux/Windows
Ctrl+P - Quick Open
Ctrl+Shift+P - Command Palette
Ctrl+D - Select Next Occurrence
Ctrl+Shift+L - Select All Occurrences

Summary

Mastering VS Code shortcuts will significantly boost your productivity:

  • Navigation: Quick file and symbol access
  • Editing: Multi-cursor and advanced text manipulation
  • Search: Powerful find and replace with regex
  • Formatting: Consistent code formatting
  • Git: Integrated version control
  • Debugging: Efficient debugging workflow

Need More Help?

Want to customize your VS Code shortcuts or learn advanced productivity techniques? Our productivity experts can help you optimize your development workflow.

Get Productivity Help