Keyboard shortcuts for navigating working files in Visual Studio Code
I'm used to having the numbered tabs being tabbable with your keyboard. Similar to Google Chrome.
cmd+1 # First tab
cmd+2 # Second tab
etc.
I did not find the settings for this in Visual Studio Code. I was able to map the keys to the arrows to be able to tab through one at a time.
[{
"key": "cmd+shift+left",
"command": "workbench.action.previousEditor"
}, {
"key": "cmd+shift+right",
"command": "workbench.action.nextEditor"
}]
It is not ideal, but it will do.
Ctrl + Page Up
Ctrl + Page Down
would be the best answer for navigating sequential tabs.
For Macs: from the menu, select menu Code → Preferences → Keyboard Shortcuts to open User/keybindings.json
. Then inside the square brackets, add:
{ "key": "shift+cmd+[", "command": "workbench.action.previousEditor"},
{ "key": "shift+cmd+]", "command": "workbench.action.nextEditor"}
This binds the standard Mac tab switching shortcuts ⌘+shift+[ and ⌘+shift+] to switch to previous and next tab, respectively. It was tested in Visual Studio Code 1.3.1.
If you'd rather use ⌘+⌥+← and ⌘+⌥+→, the key strings for those are "cmd+alt+left"
and "cmd+alt+right"
. Although from my testing it looks like these are already bound to the appropriate commands by default in Visual Studio Code 1.3.1, so maybe this question is obsolete?
I like the idea of having commands for closing a working file or closing all working files and I can look into adding those for the next update.
As for navigation between working files: We have a very powerful tool for navigation called Navigate History. By default it is assigned to Ctrl + Tab and you can leave the Ctrl key pressed and click Tab to cycle through the list of files, similar how you can switch between windows on the OS.
Navigate history is not identical to what you are asking for because it also contains files that you opened that are not in working files. Can you give it a try and report back if it solves the navigation problem for you?
We feel that this is a more natural way of navigating, because you don't have to worry about the order of working files. Instead you navigate across the list of most recently used files.
In our team we are so used to Navigate history that we cannot live without it anymore. Very often we would press Ctrl + Tab one or two times without even looking at the list that opens because we know that the file we want was either one or two history entries away.
Update
With the release of Visual Studio Code 0.5.0 there are now keyboard shortcuts to navigate back and forward in the list of working files. The shortcut is CMD + K + ↑ and CMD + K + ↓ (on Windows use the Ctrl key).