VS Code on a Mac: learning shortcuts, including the ones you changed
Three shortcuts in VS Code on a Mac lead to all the others: Command-Shift-P (⇧⌘P) opens the Command Palette, Command-P opens any file by name, and Command-K then Command-S opens the Keyboard Shortcuts editor. The shortcuts you changed yourself are saved in a file called keybindings.json, and typing @source:user into the Keyboard Shortcuts editor’s search box lists only those.
Below: the three, the shortcuts worth learning next, where the Mac differs from guides written for Windows, and how to keep track of your own bindings.
Start with the three that find everything else
Command Palette, Command-Shift-P. Every command in VS Code and in your extensions is here. Type a few letters of what you want, press Return, and it runs. F1 opens it too. Each command that has a shortcut shows that shortcut on the right of the list, which makes the palette the best teacher VS Code has: use it for a command three times, read the shortcut each time, and the fourth time press the keys instead.
Quick Open, Command-P. Type part of a file name to open it. The same box takes prefixes: type a colon and a number to jump to that line, or @ to jump to a symbol in the current file.
Keyboard Shortcuts editor, Command-K Command-S. A searchable list of every command with its binding, its “when” condition and where the binding came from. You can also open it from the Command Palette with “Preferences: Open Keyboard Shortcuts”.
Command-K Command-S is a chord: press Command-K, let go, then press Command-S. The status bar says VS Code is waiting for the second key of the chord. Several of its shortcuts work this way.
The shortcuts worth learning next
These are VS Code’s defaults on a Mac, checked against VS Code 1.108.
| Shortcut | Command |
|---|---|
| ⌘B | Show or hide the Primary Side Bar |
| ⌘J | Show or hide the panel |
| ⌃` | Show or hide the terminal |
| ⇧⌘F | Find in Files |
| ⇧⌘O | Go to Symbol in Editor |
| ⌘T | Go to Symbol in Workspace |
| ⌃G | Go to Line/Column |
| ⌘D | Add Selection to Next Find Match |
| ⇧⌘L | Select All Occurrences of Find Match |
| ⌥⌘↑ / ⌥⌘↓ | Add Cursor Above / Below |
| ⌥↑ / ⌥↓ | Move Line Up / Down |
| ⌘/ | Toggle Line Comment |
| ⇧⌥F | Format Document |
| F2 | Rename Symbol |
| F12 | Go to Definition |
| ⌘, | Settings |
Learn them a few at a time. Pick the two that match something you do every hour, use only those for a week, then add two more.
Where the Mac differs from Windows guides
Most VS Code guides online are written for Windows, and the conversion is mostly Ctrl to Command and Alt to Option. A few are not:
- The terminal stays on Control. Control-backquote (⌃`) shows and hides it on a Mac too. Command-backquote belongs to macOS, which uses it to move between the windows of the app you are in.
- Go to Line is Control-G. On a Mac, Command-G is Find Next in nearly every app, VS Code included, so Go to Line uses Control.
- F2 and F12 need fn on a MacBook. Rename Symbol and Go to Definition sit on keys that control screen brightness and volume first. Hold fn (or the Globe key), or switch the top row as described in Function keys on a MacBook.
- Alt means Option. Moving a line is Option-Up Arrow, and adding a cursor above is Option-Command-Up Arrow.
Find any shortcut, including the ones you changed
The Keyboard Shortcuts editor answers two questions: what is the shortcut for this command, and what does this key do.
- By command. Type part of the command’s name in the search box.
- By key. Click the keyboard button at the right of the search box (Record Keys, or press Option-Command-K), then press the keys. The list shows every command bound to them, which is how you find out why a shortcut does something unexpected.
- Only yours. Type @source:user in the search box. The Source column says User for bindings you set and System for VS Code’s own, and shows the extension’s name for ones an extension added. The editor’s More Actions menu has Show User Keybindings, which types the filter for you.
To change a binding, double-click its row, press the new keys, then press Return. VS Code writes the change to keybindings.json, which on a Mac lives at ~/Library/Application Support/Code/User/keybindings.json. To edit the file itself, run “Preferences: Open Keyboard Shortcuts (JSON)” from the Command Palette. Each entry names a key and a command, and a command with a minus in front removes a default binding:
[
{ "key": "cmd+t", "command": "workbench.action.terminal.new" },
{ "key": "cmd+t", "command": "-workbench.action.showAllSymbols" }
]
That pair moves Command-T from Go to Symbol in Workspace to opening a new terminal. Because the file is plain JSON, it is also easy to copy to another Mac or keep with your dotfiles.
For a list of the defaults on paper, Help > Keyboard Shortcuts Reference (Command-K Command-R) opens Microsoft’s printable sheet for macOS. It shows VS Code’s defaults, not your changes, which is exactly the gap most people run into after a year of tweaking. Learn your editor’s keybindings, including the ones you changed goes into that problem across editors.
Keeping your own bindings in front of you
A printed sheet goes out of date the day you rebind something. A cheatsheet that reads your settings does not.
Typebar shows a keyboard on your screen. Hold Command, Option, Control or Shift for a moment in VS Code and the keys relabel with what they do there. It reads your own keybindings from VS Code’s settings file, so a key you moved shows up where you put it, and it does the same for Cursor and Windsurf. A hand-made VS Code pack covers shortcuts the menus leave out. The Cheatsheet List is searchable: type a command, pick it and its keys light up, or look at which keys VS Code leaves free before you bind something new. Which keys does an app leave free? explains how to pick a binding that will not collide.
If you record coding videos, Typebar’s keystroke pill names each shortcut as you press it, using the name from the app’s menus, so viewers can follow along. Making a coding screencast where viewers can follow every shortcut covers the rest of that setup.
Typebar is $9 once, with a 24-hour free trial.
Questions
Where is keybindings.json on a Mac?
In ~/Library/Application Support/Code/User/keybindings.json. The quickest way to open it is “Preferences: Open Keyboard Shortcuts (JSON)” in the Command Palette.
How do I see only the shortcuts I changed in VS Code?
Open the Keyboard Shortcuts editor with Command-K Command-S and type @source:user in the search box.
Why does Command-backquote not open the terminal?
macOS uses Command-backquote to switch between windows of the same app. VS Code’s terminal shortcut on a Mac is Control-backquote.
Is there a printable list of VS Code shortcuts for Mac?
Yes. Help > Keyboard Shortcuts Reference opens Microsoft’s sheet of the macOS defaults. It does not include bindings you changed.