My Favorites
Most Useful VS Code Shortcuts#
Ten shortcuts that cover the majority of daily VS Code tasks. If you learn nothing else, learn these.
| Action | Windows / Linux | macOS | Command ID | Use case | |
|---|---|---|---|---|---|
| Command Palette | CtrlShiftP | CmdShiftP | workbench.action.showCommands | Run any VS Code command | |
| Quick Open file | CtrlP | CmdP | workbench.action.quickOpen | Jump to a file by name | |
| Go to symbol in file | CtrlShiftO | CmdShiftO | workbench.action.gotoSymbol | Navigate inside the current file | |
| Go to line | CtrlG | CtrlG | workbench.action.gotoLine | Jump to a specific line number | |
| Toggle terminal | Ctrl` | Ctrl` | workbench.action.terminal.toggleTerminal | Open or hide the integrated terminal | |
| Search in all files | CtrlShiftF | CmdShiftF | workbench.view.search | Project-wide text search | |
| Source Control (Git) | CtrlShiftG | CtrlShiftG | workbench.view.scm | Open Git / source control panel | |
| Run and Debug | CtrlShiftD | CmdShiftD | workbench.view.debug | Open the debugging view | |
| Format document | ShiftAltF | ShiftOptionF | editor.action.formatDocument | Format the current file | |
| Open Keyboard Shortcuts | CtrlK CtrlS | CmdK CmdS | workbench.action.openGlobalKeybindings | Edit shortcuts |
VS Code Workflow Shortcuts by Task#
Find the right shortcut or command based on what you want to accomplish, not by category name.
| I want to... | Shortcut (Win/Linux) | Shortcut (macOS) | Or run this command | |
|---|---|---|---|---|
| Open any command | CtrlShiftP | CmdShiftP | Show All Commands | |
| Open a file quickly | CtrlP | CmdP | Go to File | |
| Open terminal | Ctrl` | Ctrl` | View: Toggle Terminal | |
| Create new terminal | CtrlShift` | CtrlShift` | Terminal: Create New Terminal | |
| Search all files | CtrlShiftF | CmdShiftF | Search: Find in Files | |
| Replace across files | CtrlShiftH | CmdShiftH | Replace in Files | |
| Open Git panel | CtrlShiftG | CtrlShiftG | View: Show Source Control | |
| Start debugging | F5 | F5 | Debug: Start Debugging | |
| Run without debugging | CtrlF5 | CtrlF5 | Run Without Debugging | |
| Format file | ShiftAltF | ShiftOptionF | Format Document | |
| Open settings | Ctrl, | Cmd, | Preferences: Open Settings | |
| Edit shortcuts | CtrlK CtrlS | CmdK CmdS | Preferences: Open Keyboard Shortcuts | |
| Select Python interpreter | CtrlShiftP then type | CmdShiftP then type | Python: Select Interpreter | |
| Zoom in | Ctrl= | Cmd= | View: Zoom In (zoom guide) | |
| Change font | Ctrl, | Cmd, | Preferences: Open Settings (font guide) | |
| Preview Markdown Adv | CtrlShiftV | CmdShiftV | Markdown: Open Preview (guide) |
Editing Shortcuts#
Line manipulation, multi-cursor, formatting, and comments. These shortcuts save the most keystrokes per day. See also: indent multiple lines, format code, autoformat.
Line operations
| Action | Windows / Linux | macOS | |
|---|---|---|---|
| Move line up / down | Alt↑ / ↓ | Option↑ / ↓ | |
| Copy line up / down | ShiftAlt↑ / ↓ | ShiftOption↑ / ↓ | |
| Delete line | CtrlShiftK | CmdShiftK | |
| Insert line below | CtrlEnter | CmdEnter | |
| Insert line above | CtrlShiftEnter | CmdShiftEnter | |
| Join lines Adv | CtrlJ | CtrlJ |
Multi-cursor editing
| Action | Windows / Linux | macOS | |
|---|---|---|---|
| Add cursor above / below | CtrlAlt↑ / ↓ | OptionCmd↑ / ↓ | |
| Add cursor with click | Alt+click | Option+click | |
| Add selection to next match | CtrlD | CmdD | |
| Select all occurrences | CtrlShiftL | CmdShiftL | |
| Cursor at line ends Adv | ShiftAltI | ShiftOptionI | |
| Undo last cursor Adv | CtrlU | CmdU |
Formatting and comments
| Action | Windows / Linux | macOS | |
|---|---|---|---|
| Format document | ShiftAltF | ShiftOptionF | |
| Format selection Adv | CtrlK CtrlF | CmdK CmdF | |
| Toggle line comment | Ctrl/ | Cmd/ | |
| Toggle block comment Adv | ShiftAltA | ShiftOptionA | |
| Trim trailing whitespace Adv | CtrlK CtrlX | CmdK CmdX | |
| Indent line / selection | Tab | Tab | |
| Outdent line / selection | ShiftTab | ShiftTab |
Search and Replace Shortcuts#
From quick in-file finds to project-wide regex replacements. See also: full find-and-replace guide.
| Action | Windows / Linux | macOS | |
|---|---|---|---|
| Find in file | CtrlF | CmdF | |
| Replace in file | CtrlH | OptionCmdF | |
| Search in all files | CtrlShiftF | CmdShiftF | |
| Replace in all files | CtrlShiftH | CmdShiftH | |
| Next match | F3 | F3 | |
| Previous match | ShiftF3 | ShiftF3 | |
| Toggle match case Adv | AltC | OptionCmdC | |
| Toggle whole word Adv | AltW | OptionCmdW | |
| Toggle regex Adv | AltR | OptionCmdR |
Common search patterns (enable regex mode first)
| Goal | Pattern |
|---|---|
| Find TODO comments | TODO |
| Find console.log | console\.log |
| Find trailing spaces | [ \t]+$ |
| Find empty lines | ^\s*$ |
| Remove empty lines | Find: ^\s*$\n / Replace: blank |
Search articles
Integrated Terminal Workflow#
VS Code's integrated terminal runs shell commands without leaving the editor. You can open multiple terminals, switch shell profiles (PowerShell, Bash, Zsh, WSL, and others), and run build tasks directly. The terminal opens in the workspace root by default. See the full VS Code terminal guide.
| Action | Windows / Linux | macOS | |
|---|---|---|---|
| Toggle terminal | Ctrl` | Ctrl` | |
| New terminal | CtrlShift` | CtrlShift` | |
| Open external terminal | CtrlShiftC | CmdShiftC | |
| Run build task | CtrlShiftB | CmdShiftB | |
| Split terminal Adv | CtrlShift5 | Cmd\ |
Run a Node project
npm install npm run dev
Run a Python file
python file.py
Create and activate a virtual environment
python -m venv .venv .venv\Scripts\activate
python3 -m venv .venv source .venv/bin/activate
code command opens VS Code from any terminal folder. See how to open VS Code from terminal if the command is not recognised.Terminal articles
Python Workflow#
VS Code has strong Python support via the Python extension. Interpreter selection, venv management, and debugging are all available without leaving the editor. Rows marked with * use the Command Palette or panel rather than a direct keyboard shortcut.
| Goal | Shortcut / Command | |
|---|---|---|
| Open Command Palette | CtrlShiftPCmdShiftP | |
| Select Python interpreter | Python: Select Interpreter | |
| Create environment | Python: Create Environment | |
| Refresh environments Adv | Python Environments: Refresh All Environment Managers | |
| Run Python file in terminal | Python: Run Python File in Terminal | |
| Start debugging | F5 | |
| Run without debugging | CtrlF5 | |
| Toggle terminal | Ctrl` | |
| Install matplotlib | Terminal: pip install matplotlib (guide) |
Recommended Python project setup
python -m venv .venv .venv\Scripts\activate pip install -r requirements.txt
python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt
Git Workflow in VS Code#
VS Code's Source Control view handles most Git tasks visually. Rows marked with * use the panel, not a keyboard shortcut. For full terminal Git use the integrated terminal.
| Goal | Shortcut / Command | |
|---|---|---|
| Open Source Control | CtrlShiftG | |
| Clone repository | Command Palette: Git: Clone | |
| Initialise repository | Command Palette: Git: Initialize Repository | |
| Stage changes | Source Control panel: click + next to files | |
| Commit changes | Source Control: type message, press CtrlEnterCmdEnter | |
| Sync / Push / Pull | Source Control: Sync button or three-dot menu | |
| Create branch | Command Palette: Git: Create Branch | |
| Connect to GitHub | See connecting VS Code to GitHub |
Command Palette Git commands Adv
| Command | Action |
|---|---|
| Git: Clone | Clone a remote repository locally |
| Git: Initialize Repository | Run git init in current folder |
| Git: Commit | Commit staged changes |
| Git: Pull | Fetch and merge from remote |
| Git: Push | Push commits to remote |
| Git: Sync | Pull then push in one step |
| Git: Checkout to... | Switch branch or tag |
| Git: Create Branch | Create and switch to a new branch |
| Git: Merge Branch | Merge a branch into current |
Git articles
Debugging Shortcuts#
VS Code's built-in debugger works with most languages through extensions. Press F5 to start. For simple files you usually do not need a launch.json.
| Action | Windows / Linux | macOS | |
|---|---|---|---|
| Start / Continue | F5 | F5 | |
| Run without debugging | CtrlF5 | CtrlF5 | |
| Toggle breakpoint | F9 | F9 | |
| Step over | F10 | F10 | |
| Step into | F11 | F11 | |
| Step out | ShiftF11 | ShiftF11 | |
| Stop debugging | ShiftF5 | ShiftF5 | |
| Open Run and Debug view | CtrlShiftD | CmdShiftD |
Basic debugging flow
- 1Open the file you want to debug.
- 2Add a breakpoint with F9. A red dot appears in the gutter.
- 3Press F5 to start the debugger.
- 4When execution pauses, inspect variables in the Run and Debug panel.
- 5Use F10 (step over) or F11 (step into) to move through the code.
- 6Press F5 to continue or ShiftF5 to stop.
When do you need launch.json?
| Scenario | Need launch.json? |
|---|---|
| Debug the active file directly | Usually not |
| Web app with a specific entry file | Yes |
| Remote attach to a running process | Yes |
| Custom environment variables | Yes |
| Multiple debug configurations | Yes |
| Debug a React app | Yes (React debug guide) |
Debugging articles
Tasks Workflow#
Tasks let you run shell commands (build, test, lint, start server) from VS Code without opening a terminal each time. Tasks are defined in .vscode/tasks.json.
Common task commands
| Workflow | Command |
|---|---|
| Node dev server | npm run dev |
| Build project | npm run build |
| Run JS tests | npm test |
| Run Python file | python main.py |
| Run Django server | python manage.py runserver |
| Docker Compose up | docker compose up |
| Run JavaScript file | node index.js (JS guide) |
| Run TypeScript file | ts-node file.ts (TS guide) |
| Run Java project | Java Extension Pack (Java guide) |
Example tasks.json Adv
{
"version": "2.0.0",
"tasks": [
{
"label": "Run dev server",
"type": "shell",
"command": "npm run dev",
"group": "build",
"problemMatcher": []
},
{
"label": "Run Python tests",
"type": "shell",
"command": "python -m pytest",
"problemMatcher": []
}
]
}How to Customise VS Code Shortcuts#
Every VS Code shortcut can be changed, removed, or added. Use the Keyboard Shortcuts editor for a visual interface or edit keybindings.json directly for full control. See also: VS Code settings guide, open settings.json.
Open the Keyboard Shortcuts editor
The three keybinding fields
| Field | Meaning | Required? |
|---|---|---|
key | The keyboard combination to trigger the command | Yes |
command | The VS Code command ID to execute | Yes |
when | Optional condition controlling when the shortcut fires | No |
Example: add a custom shortcut
[
{
"key": "ctrl+alt+t",
"command": "workbench.action.terminal.toggleTerminal"
}
]Example: conditional keybinding Adv
[
{
"key": "ctrl+shift+r",
"command": "workbench.action.reloadWindow",
"when": "editorTextFocus"
}
]when values: editorTextFocus, terminalFocus, inDebugMode, editorLangId == 'python'. Combine with && for multiple conditions.Settings and editor comparison articles
Troubleshooting VS Code Shortcuts#
If a shortcut is not working, the most common causes are conflicts with extensions, the OS, or a previous custom keybinding.
Shortcut does not fire
| Cause | How to check |
|---|---|
| Extension conflict | Disable extensions one by one and retest |
| OS-level shortcut taking priority | Check system keyboard settings |
| GPU driver override | Update graphics drivers or reassign the shortcut |
| Different keyboard layout | Some keys map differently across layouts. Search by command name in the Shortcuts editor. |
| Terminal has focus, not editor | Click in the editor area first, then try again |
| Previously remapped shortcut | Search for the command name in the Keyboard Shortcuts editor |
| Browser capturing the key | Mainly affects the VS Code web version |
Find shortcut conflicts
- 1Open the Keyboard Shortcuts editor (CtrlK CtrlSCmdK CmdS).
- 2Search for the key combination, e.g. CtrlD.
- 3Right-click any result and choose Show Same Keybindings.
- 4Unbind or reassign any conflicts.
Terminal shortcuts behave differently
The integrated terminal captures focus differently from the editor. Some key combinations are sent directly to the shell rather than VS Code. If a shortcut works in the editor but not the terminal, customise it with a when: terminalFocus clause in keybindings.json. See the VS Code terminal guide for focus and shell-configuration tips, and how to enable error squiggles for related diagnostic steps.
VS Code Shortcuts FAQ#
Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS) opens the Command Palette, which gives access to nearly every VS Code command. It is the single most powerful shortcut to learn first. See the VS Code settings guide to get more out of it, or the What is VS Code? overview for full context.Ctrl+` (backtick) on Windows/Linux and macOS. You can also run View: Toggle Terminal from the Command Palette. For a full walkthrough, see how to open terminal in VS Code and the VS Code terminal guide.Ctrl+Shift+` to create a new terminal instance alongside existing ones. You can switch between terminals using the dropdown in the terminal panel. Each terminal starts in the workspace root by default. For a broader overview of the terminal panel, see the VS Code terminal guide. If you want to run commands on a remote machine from within VS Code, see VS Code Remote SSH.Ctrl+K Ctrl+S (Windows/Linux) or Cmd+K Cmd+S (macOS) to open the Keyboard Shortcuts editor. Click the pencil icon next to a command to reassign it. For JSON editing, run Preferences: Open Keyboard Shortcuts (JSON) from the Command Palette. See also how to open settings.json and the full VS Code settings guide.Shift+Alt+F on Windows/Linux or Shift+Option+F on macOS. If nothing happens, install a formatter extension for your language first. For JavaScript or TypeScript, see how to use Prettier in VS Code. For the broader picture, see how to format code in VS Code and how to autoformat in VS Code.Ctrl+Shift+G opens the Source Control view where you can stage files, write commit messages, and sync with a remote. For cloning and branching, use the Command Palette and search for Git:. See how to connect VS Code to GitHub and how to use GitHub Copilot in VS Code for AI-assisted Git workflows.F5 starts a debugging session. Ctrl+F5 runs without the debugger. Add a breakpoint first with F9. For Python, see how to debug Python in VS Code. For React, see how to debug a React app in VS Code. To catch errors before running, see how to enable error squiggles.F5 for debugging or Ctrl+F5 to run without the debugger. For Python, use the Command Palette command Python: Run Python File in Terminal. See guides for Python, JavaScript, TypeScript, and Java.