VS Code Keyboard Shortcuts
A practical, fast-lookup cheatsheet for Visual Studio Code across macOS, Windows, and Linux. Covers how to run code (F5 vs Ctrl+F5 vs Code Runner vs REPL), smart editing, multi-cursor, unindent / reverse tab, bracket selection, collapse methods, debugging, and keymap customization.

How to Run Code in VS Code
What is the VS Code run shortcut?
It depends on how your project is configured and whether you run with the native debugger, a task runner, or a language extension:
• Built-in Debugger (F5): Compiles and launches active debug configuration, stopping at breakpoints.
• Run Without Debugging (Ctrl + F5): Runs your code immediately at full speed without halting at breakpoints.
• Code Runner Extension (Ctrl + Alt + N): Runs the active file or selected text directly and prints output to the Output panel. (Stop run: Ctrl + Alt + M). Note: Requires the "Code Runner" extension by Jun Han.
• Language REPL / Terminal (Shift + Enter): In Python, R, and Julia extensions, sends the current line or selected code to the interactive REPL terminal.
• Run Selected Lines: Highlight the target lines, then press Ctrl + Alt + N (Code Runner) or Shift + Enter (interactive terminal).
• Why does Ctrl + Enter do nothing? In vanilla VS Code, Ctrl + Enter (or Cmd + Enter on Mac) inserts a blank line below the current cursor, or commits staged Git changes if focus is in the Source Control box. It does not run scripts unless you configure a custom keybinding or work inside a notebook.
| Action / Command | macOS | Windows / Linux | Type & What it does |
|---|---|---|---|
| Start Debugging | F5 | F5 | Built-in: Launches active configuration with full breakpoints and debug tools. |
| Run Without Debugging | Ctrl + F5 | Ctrl + F5 | Built-in: Executes active file immediately at full speed without stopping at breakpoints. |
| Stop Debugging / Execution | Shift + F5 | Shift + F5 | Built-in: Terminates the running debug session or process. |
| Restart Execution | Cmd + Shift + F5 | Ctrl + Shift + F5 | Built-in: Restarts active launch target from the beginning. |
| Run Code (Active File) | Ctrl + Option + N | Ctrl + Alt + N | Code Runner Extension: Runs active file through language runner to Output tab. |
| Run Selected Lines | Ctrl + Option + N | Ctrl + Alt + N | Code Runner Extension: Highlight code lines first, then press to execute selection. |
| Stop Code Run | Ctrl + Option + M | Ctrl + Alt + M | Code Runner Extension: Stops the currently running code process. |
| Run Selection in Terminal (REPL) | Shift + Enter | Shift + Enter | Language Extension (Python/R/Julia): Sends highlighted code or current line to terminal. |
| Toggle Breakpoint | F9 | F9 | Built-in: Toggles a breakpoint on the current line. |
Open Keyboard Shortcuts & Keybindings Editor
You can view, search, and remap every command in VS Code via the visual preferences editor or the JSON config file:
| Command / Action | macOS | Windows / Linux | What it does |
|---|---|---|---|
| Command Palette | Cmd + Shift + P | Ctrl + Shift + P | Universal command palette: access every command, setting, and extension action. |
| Open Keyboard Shortcuts (UI) | Cmd + K, Cmd + S | Ctrl + K, Ctrl + S | Visual shortcut editor: search, rebind, or clear conflicting key combinations. |
| Open Keyboard Shortcuts (JSON) | Via Command Palette | Via Command Palette | Opens keybindings.json directly for advanced key bindings and 'when' clauses. |
| Open Keymap Extensions | Cmd + K, Cmd + M | Ctrl + K, Ctrl + M | Searches marketplace for IntelliJ, Sublime, Eclipse, or Vim keymaps. |
Core Navigation & Window Management
| Navigation Action | macOS | Windows / Linux | What it does |
|---|---|---|---|
| Quick Open (Files) | Cmd + P | Ctrl + P | Instant fuzzy file finder: type filename or path to jump directly. |
| Command Palette | Cmd + Shift + P | Ctrl + Shift + P | Search and execute any editor or extension command. |
| Go to Symbol in File | Cmd + Shift + O | Ctrl + Shift + O | Jumps to methods, functions, classes, and variables in the active file. |
| Go to Symbol in Workspace | Cmd + T | Ctrl + T | Searches symbols across all files in the current workspace. |
| Go to Line Number | Ctrl + G | Ctrl + G | Directly jumps to a specific line (e.g. :120). |
| Next / Previous Editor Tab | Ctrl + Tab / Ctrl + Shift + Tab | Ctrl + Tab / Ctrl + Shift + Tab | Cycles forward and backward through open editor tabs. |
| Toggle Primary Sidebar | Cmd + B | Ctrl + B | Shows or hides the file explorer / extensions sidebar. |
| Toggle Bottom Panel (Terminal) | Cmd + J (or Ctrl + `) | Ctrl + J (or Ctrl + `) | Shows or hides the terminal, output, problems, and debug console. |
| Split Editor Window | Cmd + \ | Ctrl + \ | Splits active editor into two side-by-side editor panes. |
| Close Active Editor Tab | Cmd + W | Ctrl + W | Closes current editor tab (use Cmd/Ctrl + K, W to close all). |
Editing, Multi-Cursor & Untab (Reverse Tab / Unindent)
How to untab / unindent in VS Code:
• To unindent (reverse tab) a line or highlighted block, press Shift + Tab (or Cmd/Ctrl + [).
• To indent a line or block forward, press Tab (or Cmd/Ctrl + ]).
• To edit across multiple lines at once, use multi-cursor click or vertical column selection.
| Editing & Multi-Cursor Action | macOS | Windows / Linux | What it does |
|---|---|---|---|
| Untab / Reverse Tab (Unindent) | Shift + Tab (or Cmd + [) | Shift + Tab (or Ctrl + [) | Decreases indentation of current line or highlighted selection. |
| Indent Line(s) | Tab (or Cmd + ]) | Tab (or Ctrl + ]) | Increases indentation of current line or highlighted selection. |
| Insert Extra Cursor (Click) | Option + Click | Alt + Click | Places an independent typing cursor anywhere in the editor. |
| Add Cursor Above / Below | Cmd + Option + Up / Down | Ctrl + Alt + Up / Down | Extends multiple vertical typing cursors directly above or below. |
| Select Next Occurrence | Cmd + D | Ctrl + D | Highlights next occurrence of current word for multi-cursor editing. |
| Select All Occurrences | Cmd + Shift + L | Ctrl + Shift + L | Highlights all occurrences of current symbol across the entire file. |
| Undo Last Cursor | Cmd + U | Ctrl + U | Cancels the most recently added cursor or selection. |
| Move Line Up / Down | Option + Up / Down | Alt + Up / Down | Moves current line or selected block up or down. |
| Duplicate Line Up / Down | Shift + Option + Up / Down | Shift + Alt + Up / Down | Copies current line or selected block directly above or below. |
| Delete Entire Line | Cmd + Shift + K | Ctrl + Shift + K | Deletes current line without placing it in clipboard. |
| Toggle Line Comment | Cmd + / | Ctrl + / | Comments or uncomments current line or selected code. |
| Toggle Block Comment | Shift + Option + A | Shift + Alt + A | Wraps or unwraps selection in multi-line block comments (/* ... */). |
Selection: Brackets, Matching Bracket & Column (Vertical) Select
How to use column selection and bracket matching in VS Code:
• Column (box / vertical) selection via mouse: Hold Shift + Option (Mac) or Shift + Alt (Windows/Linux) while dragging your mouse over text.
• Jump to matching bracket: Press Cmd/Ctrl + Shift + \ to bounce between opening and closing braces (), [], or {}.
• Select code between brackets: Use Smart Select (Shift + Option/Alt + Right Arrow) to expand selection outwards from inside parentheses to enclosing brackets.
| Selection Command | macOS | Windows / Linux | What it does |
|---|---|---|---|
| Column / Vertical Select (Mouse) | Shift + Option + Drag | Shift + Alt + Drag | Creates a rectangular box selection across multiple lines with mouse. |
| Jump to Matching Bracket | Cmd + Shift + \ | Ctrl + Shift + \ | Jumps cursor between matching opening and closing brackets or braces. |
| Select Between Brackets (Expand) | Shift + Option + Right | Shift + Alt + Right | Smart Select Expand: selects token, then inner bracket scope, then outer scope. |
| Shrink Selection | Shift + Option + Left | Shift + Alt + Left | Smart Select Shrink: narrows selection back to previous smaller scope. |
| Add Cursors to Line Ends | Shift + Option + I | Shift + Alt + I | Places an active cursor at the end of each selected line. |
| Toggle Column Selection Mode | Via Command Palette | Via Command Palette | Toggles default mouse selection between standard text flow and column box mode. |
Folding & Collapse Methods (Minimize All Functions)
How to collapse methods and functions in VS Code:
• Collapse / Fold All Methods: Press Cmd/Ctrl + K, Cmd/Ctrl + 0 to collapse every function and class across the entire file.
• Unfold All Methods: Press Cmd/Ctrl + K, Cmd/Ctrl + J to expand all folded regions.
• Fold by Level: Press Cmd/Ctrl + K, Cmd/Ctrl + 2 to collapse methods inside classes while keeping class headers visible.
| Folding / Collapse Command | macOS | Windows / Linux | What it does |
|---|---|---|---|
| Collapse / Fold Current Method | Cmd + Option + [ | Ctrl + Shift + [ | Folds the innermost function, method, loop, or block at cursor. |
| Unfold Current Method | Cmd + Option + ] | Ctrl + Shift + ] | Expands the folded function, method, or block at cursor. |
| Collapse All Methods (Fold All) | Cmd + K, Cmd + 0 | Ctrl + K, Ctrl + 0 | Minimizes all functions, methods, and blocks throughout the active file. |
| Unfold All Methods (Expand All) | Cmd + K, Cmd + J | Ctrl + K, Ctrl + J | Expands every collapsed region across the file. |
| Fold Methods by Level (e.g. Level 2) | Cmd + K, Cmd + 2 | Ctrl + K, Ctrl + 2 | Folds all second-level blocks (ideal for collapsing class methods). |
| Fold All Block Comments | Cmd + K, Cmd + / | Ctrl + K, Ctrl + / | Collapses all header docs, JSDoc, and multi-line comments. |
Go to Definition, Implementation, References & Quick Fix
| Action / Shortcut | macOS | Windows / Linux | What it does |
|---|---|---|---|
| Quick Fix / Code Action | Cmd + . | Ctrl + . | Opens Quick Fix suggestions: import missing modules, fix typing errors, apply refactorings. |
| Go to Definition | F12 | F12 | Jumps directly to the source declaration of the symbol. |
| Peek Definition | Option + F12 | Alt + F12 | Opens an inline popup editor displaying the definition without switching files. |
| Go to Implementation | Cmd + F12 | Ctrl + F12 | Jumps to concrete implementation of an interface, abstract method, or trait. |
| Peek Implementation | Cmd + Shift + F12 | Ctrl + Shift + F12 | Displays an inline preview listing all implementations across the workspace. |
| Find All References | Shift + F12 | Shift + F12 | Lists every location where the symbol is invoked across all project files. |
| Rename Symbol | F2 | F2 | Safely renames the identifier and updates every reference across all workspace files. |
Search & Replace (File & Workspace)
| Search / Replace Command | macOS | Windows / Linux | What it does |
|---|---|---|---|
| Find in Current File | Cmd + F | Ctrl + F | Opens the in-editor search widget. |
| Replace in Current File | Cmd + Option + F | Ctrl + H | Opens find and replace fields in the active editor. |
| Find in Entire Workspace | Cmd + Shift + F | Ctrl + Shift + F | Searches matching text across all files in open workspace. |
| Replace in Entire Workspace | Cmd + Shift + H | Ctrl + Shift + H | Global find and replace across all project files. |
| Toggle Match Case | Option + Cmd + C | Alt + C | Toggles case-sensitive matching in search bar. |
| Toggle Whole Word | Option + Cmd + W | Alt + W | Restricts search matches to entire words. |
| Toggle Regular Expression | Option + Cmd + R | Alt + R | Enables regular expression syntax evaluation in search/replace. |
Refactor & Code Formatting
| Refactor / Format Action | macOS | Windows / Linux | What it does |
|---|---|---|---|
| Format Entire Document | Shift + Option + F | Shift + Alt + F | Formats document according to configured formatter (Prettier, Black, Biome, rustfmt). |
| Format Selected Code | Cmd + K, Cmd + F | Ctrl + K, Ctrl + F | Formats only the highlighted text without touching surrounding lines. |
| Refactor Context Menu | Ctrl + Shift + R | Ctrl + Shift + R | Opens contextual refactoring tools (extract function, extract constant, inline variable). |
| Organize Imports | Shift + Option + O | Shift + Alt + O | Sorts import statements and removes unused dependencies. |
| Rename Symbol | F2 | F2 | Project-wide semantic identifier rename. |
Debugging & Stepping Controls
| Debugging Action | macOS | Windows / Linux | What it does |
|---|---|---|---|
| Start / Continue Debugging | F5 | F5 | Launches debug session or resumes execution from paused breakpoint. |
| Start Without Debugging | Ctrl + F5 | Ctrl + F5 | Executes active launch profile without halting on breakpoints. |
| Toggle Breakpoint | F9 | F9 | Sets or clears breakpoint on current line. |
| Step Over | F10 | F10 | Executes the current statement without stepping into subroutines. |
| Step Into | F11 | F11 | Steps inside the function call on the active line. |
| Step Out | Shift + F11 | Shift + F11 | Executes remaining lines of current function and pauses at the caller. |
| Stop Debugging | Shift + F5 | Shift + F5 | Terminates active debug session. |
| Restart Debugging | Cmd + Shift + F5 | Ctrl + Shift + F5 | Restarts debugger with current launch configuration. |
Git & Source Control
| Git Command | macOS | Windows / Linux | What it does |
|---|---|---|---|
| Open Source Control Panel | Ctrl + Shift + G | Ctrl + Shift + G | Opens Git source control panel to view staged and unstaged file changes. |
| Commit Changes | Cmd + Enter | Ctrl + Enter | Commits staged changes when focus is inside the commit message text box. |
| Toggle Git Diff / View Changes | Cmd + K, Cmd + D | Ctrl + K, Ctrl + D | Opens working diff view against HEAD. |
Zen Mode & Focus Workspace
| Focus Command | macOS | Windows / Linux | What it does |
|---|---|---|---|
| Toggle Zen Mode | Cmd + K, Z | Ctrl + K, Z | Distraction-free full screen hiding tabs, activity bar, and sidebars. |
| Exit Zen Mode | Esc, Esc | Esc, Esc | Press Escape twice (or repeat shortcut) to return to regular layout. |
| Toggle Centered Editor Layout | Via Command Palette | Via Command Palette | Centers the active editor with comfortable side margins. |
| Toggle Menu Bar (Win/Linux) | Alt | Alt | Temporarily reveals or hides the top application menu bar on Windows/Linux. |
Coming from IntelliJ IDEA or Sublime Text
If you are switching to VS Code from IntelliJ IDEA, WebStorm, PyCharm, or Sublime Text, you do not need to relearn everything from scratch:
• Keymap Extensions: Search the Extensions marketplace (Cmd/Ctrl + Shift + X) for "IntelliJ IDEA Keybindings" or "Sublime Text Keymap and Settings Importer" to keep your original keystrokes.
• Search Everywhere: IntelliJ uses Shift + Shift; in native VS Code, use Cmd/Ctrl + P for file search, or Cmd/Ctrl + Shift + P for all commands.
• Quick Fix / Intention Actions: IntelliJ uses Alt + Enter; native VS Code uses Cmd + . (Mac) or Ctrl + . (Windows/Linux).
• File Structure / Symbols: IntelliJ uses Cmd/Ctrl + F12; native VS Code uses Cmd/Ctrl + Shift + O.
• Rename Symbol: Both IntelliJ and VS Code use Shift + F6 / F2.
Printable Minimal Daily Loop (Pro Workflow)
Build muscle memory around a fast, mouse-free cycle: open file, multi-cursor edit, untab, fix, rename, format, run, and commit:
Cmd/Ctrl + P # 1. Quick open target file
Option/Alt + Click # 2. Multi-cursor editing
Shift + Tab # 3. Untab / unindent lines
Cmd/Ctrl + . # 4. Quick fix / import auto-fix
F2 # 5. Semantic rename symbol
Shift + Alt/Opt + F # 6. Format entire document
Ctrl + F5 # 7. Run code without debugging (or F5 to debug)
Cmd/Ctrl + Enter # 8. Commit in Git panelOfficial References & Custom Keybindings File
To customize or remap shortcuts, open your User keybindings.json file:
• macOS: ~/Library/Application Support/Code/User/keybindings.json
• Windows: %APPDATA%\Code\User\keybindings.json
• Linux: ~/.config/Code/User/keybindings.json
Official Microsoft documentation:
• Default Keyboard Shortcuts Reference: https://code.visualstudio.com/docs/reference/default-keybindings
• Key Bindings and Customization Guide: https://code.visualstudio.com/docs/configure/keybindings
Related
Official VS Code Default Keybindings (Microsoft)
Official printable keyboard shortcut reference sheets for macOS, Windows, and Linux.
Official Key Bindings Guide (Microsoft)
How to configure custom keybindings, when clauses, and keybindings.json.
IntelliJ IDEA Keyboard Shortcuts
Essential IntelliJ shortcuts for search, editing, refactoring, and debugging.
Visual Studio Keyboard Shortcuts
Standard Visual Studio IDE hotkeys for builds, navigation, and debugging.
Sublime Text Keyboard Shortcuts
Fast lookup cheatsheet for Sublime Text editing, multi-cursor, and find hotkeys.
Text & Code Diff Checker
Compare code side-by-side online with line and character diff highlighting.
Knowledge is power.