Growing with the Web

Simulating tabs with custom keybindings in Visual Studio Code


Tabs are currently under consideration by the VS Code team. In the meantime you can simulate tab keybindings for the most part by adding some custom ones.

The following keybindings will make ctrl + w and ctrl + shift + w behave as if they were tabs; removing the file and all files from the working files list respectively. This will also remove them from the active documents list, even for files that were only being previewed.

< v1.3.0:

{ "key": "ctrl+w",       "command": "workbench.files.action.closeFile" },
{ "key": "ctrl+shift+w", "command": "workbench.files.action.closeAllFiles" }

>= v1.3.0:

With the editor stacks feature coming in v1.3.0, the keybindings are changing. This is one of the steps involved in implementing true tabs in VSCode:

{ "key": "ctrl+shift+w", "command": "workbench.action.closeAllEditors" }

Follow the official documentation if you’re unsure how to add custom keybindings.

Like this article?
Subscribe for more!