By default, Visual Studio Code does not support cmd+number-style tab switching on macOS. But it can be enabled with a simple configuration change.
- From within VS Code, enter
cmd+shift+p
to open the Command Palette. This allows commands to be searched by name. - Enter
Preferences: Open Keyboard Shortcuts (JSON)
. [There are other similarly-named commands, so careful reading is advised.] - This should open the
keybindings.json
file. Add the following entries, and save the file:
[
{
"key": "cmd+1",
"command": "workbench.action.openEditorAtIndex1"
},
{
"key": "cmd+2",
"command": "workbench.action.openEditorAtIndex2"
},
{
"key": "cmd+3",
"command": "workbench.action.openEditorAtIndex3"
},
{
"key": "cmd+4",
"command": "workbench.action.openEditorAtIndex4"
},
{
"key": "cmd+5",
"command": "workbench.action.openEditorAtIndex5"
},
{
"key": "cmd+6",
"command": "workbench.action.openEditorAtIndex6"
},
{
"key": "cmd+7",
"command": "workbench.action.openEditorAtIndex7"
},
{
"key": "cmd+8",
"command": "workbench.action.openEditorAtIndex8"
},
{
"key": "cmd+9",
"command": "workbench.action.openEditorAtIndex9"
}
]
After restarting VS Code, cmd
+ number (cmd+1
, cmd+2
, etc.) tab switching should work properly.