Visual Studio Code keyboard shortcuts for Mac
Edit code, navigate symbols, search a workspace and use editor groups deliberately.
Documentation reviewed 2026-11-03 · 20 task guides · Mac bindings and focus notes
What do you want to do?
Close or reopen a VS Code editor without losing track of the file
Command-W closes the active editor; Shift-Command-T reopens a closed editor. Keep closing an editor separate from deleting a file.
Steps, keys and context ↗Choose VS Code’s Command Palette or Quick Open
Shift-Command-P searches commands; Command-P searches files. Use the palette for an action and Quick Open for a destination.
Steps, keys and context ↗Choose Step Over, Into or Out in the VS Code debugger
F10 steps over, F11 steps into and Shift-F11 steps out during a supported debugging session. The active debug configuration controls what is running.
Steps, keys and context ↗Peek at a VS Code definition or open it as an editor
F12 opens a definition and Option-F12 peeks at one when language support is available. Choose whether the inspection should replace your current view.
Steps, keys and context ↗Expand and shrink a structured VS Code selection
Control-Shift-Command-Right Arrow expands a smart selection; the Left Arrow variant shrinks it when the editor and language support that structure.
Steps, keys and context ↗Find and replace text inside the current VS Code file
Command-F opens Find and Option-Command-F opens Replace in the current editor. Verify the file and matching options before replacing text.
Steps, keys and context ↗Find a VS Code symbol in one file or across a workspace
Shift-Command-O searches symbols in the current file; Command-T searches symbols across the workspace when language support provides them.
Steps, keys and context ↗Fold VS Code regions without forgetting what is hidden
Option-Command-[ folds a region and Option-Command-] unfolds it. Folding changes visibility, not which code exists in the file.
Steps, keys and context ↗Format a VS Code document or only the selected code
Shift-Option-F formats the document; Command-K then Command-F formats the selection when an appropriate formatter is available.
Steps, keys and context ↗Jump to a VS Code line and return to the previous edit location
Control-G opens Go to Line. Control-Minus and Control-Shift-Minus move backward and forward through editor navigation history.
Steps, keys and context ↗Comment VS Code lines without confusing line and block comments
Command-/ toggles a line comment; Shift-Option-A toggles a block comment. The active language determines the comment syntax.
Steps, keys and context ↗Reorder or duplicate VS Code lines without a cut-and-paste detour
Option-Up/Down moves a line; Shift-Option-Up/Down copies it. Adding Shift changes the result from relocation to duplication.
Steps, keys and context ↗Move through VS Code errors and warnings with context
Shift-Command-M opens Problems. F8 goes to the next error or warning and Shift-F8 goes to the previous one.
Steps, keys and context ↗Rename a VS Code symbol instead of replacing similar text
F2 starts a language-aware symbol rename when supported. Use it when you mean a code symbol, rather than every matching string.
Steps, keys and context ↗Run a VS Code build task after checking what it executes
Shift-Command-B invokes Run Build Task. A task is executable configuration, so inspect the selected task and workspace before running it.
Steps, keys and context ↗Edit selected repeated text with VS Code multi-cursors
Command-D adds the next matching occurrence to a selection. Command-U undoes the last cursor operation, giving you a way to correct the selection set.
Steps, keys and context ↗Split VS Code editors and move focus between groups
Command-Backslash splits the editor. Command-1, Command-2 and Command-3 focus the corresponding editor groups.
Steps, keys and context ↗Open the VS Code terminal or create a separate session
Control-` shows the integrated terminal; Control-Shift-` creates a new terminal. Confirm the shell and working directory before running anything.
Steps, keys and context ↗Search a VS Code workspace with deliberate include and exclude rules
Shift-Command-F opens workspace search; Shift-Command-H opens replacement across files. Narrow the scope before applying changes.
Steps, keys and context ↗Use VS Code Zen Mode and word wrap for different reading problems
Command-K then Z enters Zen Mode; Option-Z toggles word wrap. One changes workspace presentation, while the other changes how long lines are displayed.
Steps, keys and context ↗
Quick reference
Selected bindings from the linked task guides. Check the context before pressing a key: the focused control, app version and your custom settings can change what it does. This is a documentation reference, not an exhaustive live menu reading.
| Action | Keys | Context |
|---|---|---|
| Close the active editor | Command-W | Applies to the active editor context; handle any save prompt deliberately. Source ↗Read the task guide → |
| Search editor commands | Shift-Command-P | The Command Palette lists commands rather than repository files. Source ↗Read the task guide → |
| Step over | F10 | Advances within the active debugging workflow. Source ↗Read the task guide → |
| Open the definition | F12 | Uses the current language provider’s definition information. Source ↗Read the task guide → |
| Expand the structured selection | Control-Shift-Command-Right Arrow | Depends on the syntax and language support of the focused editor. Source ↗Read the task guide → |
| Find in the current file | Command-F | Uses the focused editor’s document context. Source ↗Read the task guide → |
| Find a symbol in this file | Shift-Command-O | Uses symbols from the active editor’s language support. Source ↗Read the task guide → |
| Fold the current region | Option-Command-[ | Collapses a recognised code region near the cursor. Source ↗Read the task guide → |
| Format the document | Shift-Option-F | Requires a formatter suitable for the active language. Source ↗Read the task guide → |
| Jump to a line | Control-G | Open the correct file before using a line-number reference. Source ↗Read the task guide → |
| Toggle line comment | Command-/ | Uses the active language’s line-comment behaviour. Source ↗Read the task guide → |
| Move a line upward | Option-Up Arrow | Can act on the selected lines rather than only one line. Source ↗Read the task guide → |
| Open Problems | Shift-Command-M | Inspect diagnostic source, file and message. Source ↗Read the task guide → |
| Rename the current symbol | F2 | Requires language support and an appropriate symbol under the cursor. Source ↗Read the task guide → |
| Run the configured build task | Shift-Command-B | May require choosing a task; inspect what it will execute. Source ↗Read the task guide → |
| Add the next matching occurrence | Command-D | Build the selected matches incrementally and inspect their contexts. Source ↗Read the task guide → |
| Split the current editor | Command-Backslash | Creates another editor group according to the current layout. Source ↗Read the task guide → |
| Show the integrated terminal | Control-` | Uses the backtick key; layout and terminal settings can affect the binding. Source ↗Read the task guide → |
When a shortcut behaves differently
- Confirm you are using the Mac binding, and check whether the guide describes a desktop app or its web version.
- Put focus in the control named in the guide. Editing text, selecting an object and navigating a sidebar can use different keys.
- Look up the command in the app's menu or shortcut settings. Customized keys and non-US keyboard layouts can differ from documented defaults.
The cited documentation was checked for these guides; a documentation review is separate from testing your particular running app. How we verify and update guides →
Official sources
- macOS shortcut reference — Visual Studio Code — checked 2026-11-03
- User interface — Visual Studio Code — checked 2026-11-03
- Default keyboard shortcuts — Visual Studio Code — checked 2026-11-03
- Customize keyboard shortcuts — Visual Studio Code — checked 2026-11-03
- Debugging — Visual Studio Code — checked 2026-11-03
- Code navigation — Visual Studio Code — checked 2026-11-03
- Basic editing — Visual Studio Code — checked 2026-11-03
- Refactoring — Visual Studio Code — checked 2026-11-03
- Tasks — Visual Studio Code — checked 2026-11-03
- Terminal basics — Visual Studio Code — checked 2026-11-03