Visual Studio Code is the world's most popular code editor, but most developers use only a small fraction of its capabilities, relying heavily on slow mouse navigation. Mastering keyboard navigation, multi-cursor editing, integrated terminal shortcuts, and interactive debugging transforms your coding speed and focus.
In this comprehensive productivity guide, you will master the top 15 essential VS Code shortcuts, configure launch.json for interactive Python debugging with breakpoints, and optimize your editing workflows.
Top 15 Essential VS Code Shortcuts Cheat Sheet
Prerequisites & Installation
debugpy enables interactive breakpoints and call stack stepping inside VS Code.
# Install debugpy inside your Python environment:
pip install debugpy ruff
| Action | Windows / Linux Shortcut | macOS Shortcut | Productivity Impact |
|---|---|---|---|
| Quick Open File | Ctrl + P | Cmd + P | Jump to any file in your project instantly by typing parts of its name |
| Command Palette | Ctrl + Shift + P | Cmd + Shift + P | Access every VS Code setting, extension command, and action |
| Multi-Cursor Next Match | Ctrl + D | Cmd + D | Selects the next occurrence of the current word for simultaneous editing |
| Add Multi-Cursor Click | Alt + Click | Option + Click | Place multiple typing cursors at arbitrary line positions |
| Toggle Terminal | Ctrl + ` | Ctrl + ` | Open or hide integrated terminal without leaving your cursor position |
| Duplicate Line Up/Down | Shift + Alt + Up / Down | Shift + Option + Up / Down | Duplicates current line or selection above or below |
| Move Line Up/Down | Alt + Up / Down | Option + Up / Down | Moves the current line up or down through the file |
| Toggle Line Comment | Ctrl + / | Cmd + / | Comments or uncomments selected lines instantly |
| Go to Line Number | Ctrl + G | Ctrl + G | Jump directly to a specific line number in the active file |
| Rename Symbol Refactor | F2 | F2 | Renames a variable/function across the entire project safely |
Interactive Debugging with launch.json
Relying on print() statements to debug code is slow and clutters your git commit history. VS Code includes a powerful interactive debugger that lets you pause execution at breakpoints, step through code line-by-line, and inspect variable states in real-time.
Create a .vscode/launch.json file in your project root to configure one-click debugging.
Production launch.json Configuration for Python
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Python: FastAPI Web Server",
"type": "debugpy",
"request": "launch",
"module": "uvicorn",
"args": [
"main:app",
"--reload",
"--port",
"8000"
],
"jinja": true,
"justMyCode": true
}
]
}
Advanced Editing Hacks & Workflow Optimization
- Column Selection Mode: Hold Shift + Alt and drag your mouse to select rectangular columns of text across multiple lines for simultaneous editing.
- Split Editor Right: Press Ctrl + \ to split the active editor side-by-side, allowing you to view tests and implementation code simultaneously.
- Zen Mode Focus: Press Ctrl + K, then Z to enter Zen mode, hiding all sidebars, status bars, and menus for zero-distraction coding.
Frequently Asked Questions
Q: How do I set up conditional breakpoints in VS Code?
A: Right-click the red breakpoint dot in the gutter and select 'Add Conditional Breakpoint'. Execution will pause only when your expression (e.g. user_id == 501) evaluates to True.
Q: How do I sync my VS Code settings and extensions across computers?
A: Click the Settings gear icon in the bottom-left and enable 'Settings Sync' using your GitHub account.
0 Comments