My Favorites

No results found. Try a different keyword or .

topMost Useful VS Code Shortcuts#

Ten shortcuts that cover the majority of daily VS Code tasks. If you learn nothing else, learn these.

ActionWindows / LinuxmacOSCommand IDUse case
Command Palette CtrlShiftPCmdShiftP workbench.action.showCommands Run any VS Code command
Quick Open file CtrlPCmdP workbench.action.quickOpen Jump to a file by name
Go to symbol in file CtrlShiftOCmdShiftO workbench.action.gotoSymbol Navigate inside the current file
Go to line CtrlGCtrlG 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 CtrlShiftFCmdShiftF workbench.view.search Project-wide text search
Source Control (Git) CtrlShiftGCtrlShiftG workbench.view.scm Open Git / source control panel
Run and Debug CtrlShiftDCmdShiftD workbench.view.debug Open the debugging view
Format document ShiftAltFShiftOptionF editor.action.formatDocument Format the current file
Open Keyboard Shortcuts CtrlK CtrlSCmdK CmdS workbench.action.openGlobalKeybindings Edit shortcuts
Note: Shortcuts can vary by keyboard layout, OS, installed extensions, and custom keybindings. Use CtrlK CtrlSCmdK CmdS to verify your exact setup.

#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 commandCtrlShiftPCmdShiftPShow All Commands
Open a file quicklyCtrlPCmdPGo to File
Open terminalCtrl`Ctrl`View: Toggle Terminal
Create new terminalCtrlShift`CtrlShift`Terminal: Create New Terminal
Search all filesCtrlShiftFCmdShiftFSearch: Find in Files
Replace across filesCtrlShiftHCmdShiftHReplace in Files
Open Git panelCtrlShiftGCtrlShiftGView: Show Source Control
Start debuggingF5F5Debug: Start Debugging
Run without debuggingCtrlF5CtrlF5Run Without Debugging
Format fileShiftAltFShiftOptionFFormat Document
Open settingsCtrl,Cmd,Preferences: Open Settings
Edit shortcutsCtrlK CtrlSCmdK CmdSPreferences: Open Keyboard Shortcuts
Select Python interpreterCtrlShiftP then typeCmdShiftP then typePython: Select Interpreter
Zoom inCtrl=Cmd=View: Zoom In (zoom guide)
Change fontCtrl,Cmd,Preferences: Open Settings (font guide)
Preview Markdown AdvCtrlShiftVCmdShiftVMarkdown: 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

ActionWindows / LinuxmacOS
Move line up / downAlt / Option /
Copy line up / downShiftAlt / ShiftOption /
Delete lineCtrlShiftKCmdShiftK
Insert line belowCtrlEnterCmdEnter
Insert line aboveCtrlShiftEnterCmdShiftEnter
Join lines AdvCtrlJCtrlJ

Multi-cursor editing

Multi-cursor lets you type in multiple places at once. Hold AltOption and click to add cursors anywhere.
ActionWindows / LinuxmacOS
Add cursor above / belowCtrlAlt / OptionCmd /
Add cursor with clickAlt+clickOption+click
Add selection to next matchCtrlDCmdD
Select all occurrencesCtrlShiftLCmdShiftL
Cursor at line ends AdvShiftAltIShiftOptionI
Undo last cursor AdvCtrlUCmdU

Formatting and comments

ActionWindows / LinuxmacOS
Format documentShiftAltFShiftOptionF
Format selection AdvCtrlK CtrlFCmdK CmdF
Toggle line commentCtrl/Cmd/
Toggle block comment AdvShiftAltAShiftOptionA
Trim trailing whitespace AdvCtrlK CtrlXCmdK CmdX
Indent line / selectionTabTab
Outdent line / selectionShiftTabShiftTab

>_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.

ActionWindows / LinuxmacOS
Toggle terminalCtrl`Ctrl`
New terminalCtrlShift`CtrlShift`
Open external terminalCtrlShiftCCmdShiftC
Run build taskCtrlShiftBCmdShiftB
Split terminal AdvCtrlShift5Cmd\

Run a Node project

npm install
npm run dev

Run a Python file

python file.py

Create and activate a virtual environment

Windows
python -m venv .venv
.venv\Scripts\activate
macOS / Linux
python3 -m venv .venv
source .venv/bin/activate
The code command opens VS Code from any terminal folder. See how to open VS Code from terminal if the command is not recognised.

pyPython 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.

GoalShortcut / Command
Open Command PaletteCtrlShiftPCmdShiftP
Select Python interpreterPython: Select Interpreter
Create environmentPython: Create Environment
Refresh environments AdvPython Environments: Refresh All Environment Managers
Run Python file in terminalPython: Run Python File in Terminal
Start debuggingF5
Run without debuggingCtrlF5
Toggle terminalCtrl`
Install matplotlibTerminal: pip install matplotlib (guide)
Rows marked * use the Command Palette or Source Control panel rather than a keyboard shortcut. Switch your interpreter from the Status Bar at the bottom of VS Code for a faster shortcut.

Recommended Python project setup

Windows
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
macOS / Linux
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

gitGit 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.

GoalShortcut / Command
Open Source ControlCtrlShiftG
Clone repositoryCommand Palette: Git: Clone
Initialise repositoryCommand Palette: Git: Initialize Repository
Stage changesSource Control panel: click + next to files
Commit changesSource Control: type message, press CtrlEnterCmdEnter
Sync / Push / PullSource Control: Sync button or three-dot menu
Create branchCommand Palette: Git: Create Branch
Connect to GitHubSee connecting VS Code to GitHub
Rows marked * use the Source Control panel or Command Palette rather than a direct keyboard shortcut.

Command Palette Git commands Adv

CommandAction
Git: CloneClone a remote repository locally
Git: Initialize RepositoryRun git init in current folder
Git: CommitCommit staged changes
Git: PullFetch and merge from remote
Git: PushPush commits to remote
Git: SyncPull then push in one step
Git: Checkout to...Switch branch or tag
Git: Create BranchCreate and switch to a new branch
Git: Merge BranchMerge a branch into current

F5Debugging 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.

ActionWindows / LinuxmacOS
Start / ContinueF5F5
Run without debuggingCtrlF5CtrlF5
Toggle breakpointF9F9
Step overF10F10
Step intoF11F11
Step outShiftF11ShiftF11
Stop debuggingShiftF5ShiftF5
Open Run and Debug viewCtrlShiftDCmdShiftD

Basic debugging flow

  1. 1Open the file you want to debug.
  2. 2Add a breakpoint with F9. A red dot appears in the gutter.
  3. 3Press F5 to start the debugger.
  4. 4When execution pauses, inspect variables in the Run and Debug panel.
  5. 5Use F10 (step over) or F11 (step into) to move through the code.
  6. 6Press F5 to continue or ShiftF5 to stop.

When do you need launch.json?

ScenarioNeed launch.json?
Debug the active file directlyUsually not
Web app with a specific entry fileYes
Remote attach to a running processYes
Custom environment variablesYes
Multiple debug configurationsYes
Debug a React appYes (React debug guide)

runTasks 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.

Run your default build task with CtrlShiftBCmdShiftB. To see all tasks, use the Command Palette and search for Tasks: Run Task.

Common task commands

WorkflowCommand
Node dev servernpm run dev
Build projectnpm run build
Run JS testsnpm test
Run Python filepython main.py
Run Django serverpython manage.py runserver
Docker Compose updocker compose up
Run JavaScript filenode index.js (JS guide)
Run TypeScript filets-node file.ts (TS guide)
Run Java projectJava 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

Windows / Linux
CtrlK CtrlS
macOS
CmdK CmdS

The three keybinding fields

FieldMeaningRequired?
keyThe keyboard combination to trigger the commandYes
commandThe VS Code command ID to executeYes
whenOptional condition controlling when the shortcut firesNo

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"
  }
]
Useful when values: editorTextFocus, terminalFocus, inDebugMode, editorLangId == 'python'. Combine with && for multiple conditions.

?!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

CauseHow to check
Extension conflictDisable extensions one by one and retest
OS-level shortcut taking priorityCheck system keyboard settings
GPU driver overrideUpdate graphics drivers or reassign the shortcut
Different keyboard layoutSome keys map differently across layouts. Search by command name in the Shortcuts editor.
Terminal has focus, not editorClick in the editor area first, then try again
Previously remapped shortcutSearch for the command name in the Keyboard Shortcuts editor
Browser capturing the keyMainly affects the VS Code web version

Find shortcut conflicts

  1. 1Open the Keyboard Shortcuts editor (CtrlK CtrlSCmdK CmdS).
  2. 2Search for the key combination, e.g. CtrlD.
  3. 3Right-click any result and choose Show Same Keybindings.
  4. 4Unbind or reassign any conflicts.
Run Developer: Toggle Keyboard Shortcuts Troubleshooting from the Command Palette. It logs exactly which command a keystroke triggers, making conflicts straightforward to trace.

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.

QVS 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.
Press 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.
Press 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.
Press 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.
Common causes: a conflict with an extension, an OS shortcut taking priority, the terminal having focus instead of the editor, a different keyboard layout, or a previously remapped keybinding. Open the Keyboard Shortcuts editor, search for the command, and use Show Same Keybindings to spot conflicts. You can also run Developer: Toggle Keyboard Shortcuts Troubleshooting for a real-time event log. The error squiggles guide covers related diagnostic steps.
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.
There is no single universal run shortcut because it depends on language and extensions. Use 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.
Widely recommended picks include Prettier (formatting), GitLens (Git history), Pylance (Python IntelliSense), and ESLint. See the full best VS Code extensions guide. For AI assistance, see how to use GitHub Copilot in VS Code. For managing extension settings, see the VS Code settings guide.