Last updated: Apr 6, 2024
Reading time·6 min
On Windows and Linux:
Ctrl
+ PageDown
to switch to the next tab.Ctrl
+ PageUp
to switch to the previous tab.On macOS:
Cmd
+ Option
+ Right
arrow key to switch to the next tab.Cmd
+ Option
+ Left
arrow key to switch to the previous tab.An easy way to view the keyboard shortcut for your operating system is to:
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.If you use the VSCodeVIM extension, use:
g
t
to switch to the next tab.g
T
to switch to the previous tab.g
t
to switch to a tab by index, e.g. 1
g
t
or 2
g
t
.If you need to switch tabs in order of last use:
On Windows and Linux:
Ctrl
+ Tab
to switch to the previous recently used editor in the
group.Ctrl
+ Shift
+ Tab
to switch to the least recently used editor in
the group.On macOS:
Cmd
+ Tab
to switch to the previous recently used editor in the group.Cmd
+ Shift
+ Tab
to switch to the least recently used editor in the
group.The keyboard shortcut doesn't switch to the next tab, it switches to the most recently used tab.
If you want to use the Ctrl
+ tab
and Ctrl
+ Shift
+ tab
to switch
through tabs in order, you have to update your keyboard shortcuts.
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.You can also click on the pencil icon to set up a new keyboard shortcut.
Ctrl
+ Shift
+ Tab
and then hit Enter
to confirm.If you are on macOS, press Cmd
+ Shift
+ Tab
instead.
Ctrl
+ Tab
and then hit Enter
to confirm.If you are on macOS, press Cmd
+ Tab
instead.
An alternative approach to updating your keyboard shortcuts for switching tabs
is to use your keybindings.json
file.
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.keybindings.json
file.[ { "key": "ctrl+tab", "command": "workbench.action.nextEditor" }, { "key": "ctrl+shift+tab", "command": "workbench.action.previousEditor" } // ... rest of your keybindings ]
If you are on macOS, use cmd+tab
and cmd+shift+tab
instead.
If you only want to navigate through the tabs of the current group, set the following keyboard shortcuts instead.
[ { "key": "ctrl+tab", "command": "workbench.action.nextEditorInGroup" }, { "key": "ctrl+shift+tab", "command": "workbench.action.previousEditorInGroup" } // ... rest of your keybindings ]
Now you can use the Ctrl
+ Tab keys to
navigate to the next tab and the Ctrl
+ Shift
+ Tab
keys to navigate to
the previous tab.
You can also switch to a specific tab by index with:
on Windows and Linux - Alt
+ N
, e.g. Alt
+ 1
, Alt
+ 2
.
on macOS: Control
+ N
, e.g. Control
+ 1
, Control
+ 2
.
If you'd rather use Ctrl
(or Cmd
on macOS) + N to switch to a specific tab
by index, you have to update your keyboard shortcuts.
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.keybindings.json
file.Note: Make sure to replace ctrl
with cmd
if you are on macOS, e.g.
cmd+0
, cmd+1
, etc.
[ { "key": "ctrl+0", "command": "workbench.action.openLastEditorInGroup" }, { "key": "ctrl+1", "command": "workbench.action.openEditorAtIndex1" }, { "key": "ctrl+2", "command": "workbench.action.openEditorAtIndex2" }, { "key": "ctrl+3", "command": "workbench.action.openEditorAtIndex3" }, { "key": "ctrl+4", "command": "workbench.action.openEditorAtIndex4" }, { "key": "ctrl+5", "command": "workbench.action.openEditorAtIndex5" }, { "key": "ctrl+6", "command": "workbench.action.openEditorAtIndex6" }, { "key": "ctrl+7", "command": "workbench.action.openEditorAtIndex7" }, { "key": "ctrl+8", "command": "workbench.action.openEditorAtIndex8" }, { "key": "ctrl+9", "command": "workbench.action.openEditorAtIndex9" } ]
Once you paste the objects into your keybindings.json
file, you can use the
ctrl
+ N (or cmd
+ N on macOS) keys to switch between tabs by index.
When you split your screen into 2 or more windows, use the following keyboard shortcuts to switch to the previous or next group.
On Windows and Linux:
Ctrl
+ K
Ctrl
+ Left
arrow key to switch to the previous group.Ctrl
+ K
Ctrl
+ Right
arrow key to switch to the next group.You first press Ctrl+K
, release the keys and then press Ctrl
+ left or
right.
On macOS:
Cmd
+ K
Cmd
+ Left
arrow key to switch to the previous group.Cmd
+ K
Cmd
+ Right
arrow key to switch to the next group.The default keyboard shortcuts are a bit difficult to remember.
You can update them in your keybindings.json
file.
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.keybindings.json
file.Note: the example uses alt+1
, alt+2
and alt+3
, make sure to update this
depending on your preferences.
For example, on macOS, you can use ctrl+1
, ctrl+2
and ctrl+3
.
[ { "key": "alt+1", "command": "workbench.action.focusFirstEditorGroup" }, { "key": "alt+2", "command": "workbench.action.focusSecondEditorGroup" }, { "key": "alt+3", "command": "workbench.action.focusThirdEditorGroup" } // ... your other keyboard shortcuts ]
There is also a command that you can use to open the previous editor from history.
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.Enter
.I've also written an article on how to close the active Tab or all Tabs in VS Code.
You can learn more about the related topics by checking out the following tutorials: