[visual-studio-code] Is there a quick change tabs function in Visual Studio Code?

The current function of giving me a dropdown option of which tab to choose is just so annoying. Is there a possibility to remove it so the tabs would work like in some modern web browser.

This question is related to visual-studio-code vscode-settings

The answer is


Linux In current Vscode 1.44.1 version

we could use ctrl+pageup for next editor and ctrl+pagedown for previous editor.

If there is a need to change

ctrl+shift+p > Preferences:Open Keyboard Shortcuts.

search for

nextEditor

change if needed by clicking it.


When using Visual Studio Code on Linux/Windows, you can use CTRL + PAGE_UP to switch to the previous tab, and CTRL + PAGE_DN to switch to the next tab. You also have the ability to switch to tabs based on their (non-zero relative) index. You can do so, by pressing and holding ALT , followed by a number (1 through 9).

For more details: check here


Use Sublime Text Keymaps. So much more intuitive.

?k?m

Import Sublime Text Keymaps:

Name: Sublime Text Keymap and Settings Importer
Id: ms-vscode.sublime-keybindings
Description: Import Sublime Text settings and keybindings into VS Code.
Version: 4.0.3
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode.sublime-keybindings

Another way to quickly change tabs would be in VSCode 1.45 (April 2020)

Switch tabs using mouse wheel

When you use the mouse wheel to scroll over editor tabs, you can currently not switch to the tab, only reveal tabs that are out of view.

Now with a new setting workbench.editor.scrollToSwitchTabs this behaviour can be changed if you change it to true.

https://media.githubusercontent.com/media/microsoft/vscode-docs/vnext/release-notes/images/1_45/scroll-tabs.gif

Note: you can also press and hold the Shift key while scrolling to get the opposite behaviour (i.e. you can switch to tabs even with this setting being turned off).


Better approch is use alt+right and alt+left keys to navigate like Jetbrains IDE Webstorm does

Here is my config. it also include create new file and folder

    {
        "key": "ctrl+n",
        "command": "explorer.newFile"
    },
    {
        "key": "ctrl+shift+n",
        "command": "explorer.newFolder"
    },
    { 
        "key": "alt+left",
        "command": "workbench.action.previousEditor" 
    },
    { 
        "key": "alt+right",
        "command": "workbench.action.nextEditor" 
    }

@SC_Chupacabra has correct answer for modifying behavior.

I generally prefer CTRL + PAGE UP / DOWN for my navigation, rather than using the TAB key.

    {
        "key": "ctrl+pageUp",
        "command": "workbench.action.nextEditor"
    },
    {
        "key": "ctrl+pageDown",
        "command": "workbench.action.previousEditor"
    }

Visual Studio Code v1.35.0 let's you set the (Ctrl+Tab) / (Shift+Ctrl+Tab) key sequences to sequentially switch between editors by binding those keys sequences to the commands "View: Open Next Editor" and "View: Open Previous Editor", respectively.

On macOS:

  1. Navigate to: Code > Preferences > Keyboard Shortcuts
  2. Search or navigate down to the following two options:
    • View: Open Next Editor
    • View: Open Previous Editor
  3. Change both keybindings to the desired key sequence.
    • View: Open Next Editor -> (Ctrl+Tab)
    • View: Open Previous Editor -> (Shift+Ctrl+Tab)
  4. You will likely run into a conflicting binding. If so, take note of the command and reassign or remove the existing key binding.

If you mess up, you can always revert back to the default state for a given binding by right-clicking on any keybinding and selecting "Reset Keybinding".


Linux key-map to match the browser:

[
    {
        "key": "ctrl+0",
        "command": "workbench.action.lastEditorInGroup"
    },
    {
        "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"
    },
    {
        "key": "alt+1",
        "command": "workbench.action.focusFirstEditorGroup"
    },
    {
        "key": "alt+2",
        "command": "workbench.action.focusSecondEditorGroup"
    },
    {
        "key": "alt+3",
        "command": "workbench.action.focusThirdEditorGroup"
    }
]

Windows

When using Visual Studio Code on Windows, you can use CTRL + PAGE_UP to switch to the previous tab, and CTRL + PAGE_DN to switch to the next tab.

You also have the ability to switch to tabs based on their (non-zero relative) index. You can do so, by pressing and holding ALT, followed by a number (1 through 9).

macOS

To quickly navigate between tabs, press and hold the CMD key, followed by the number (1 through 9) of the tab you want to switch to.

You also have the ability to switch between the previous/next tab via the CMD + ALT + LEFT/RIGHT keyboard shortcut.

Please note that in order to switch to a tab that is in a different editor group, you must first switch to the desired editor group.

Pro Tip: If you aren't comfortable with any of the key bindings, you can change them to whatever you feel more comfortable with!


for linux... I use ctrl+pageUp or pageDown


This also works on MAC OS:

Press for select specific Tab: Control + 1 or Control 2, Control 3, etc.

Press for show/select all posible Tabs: Control + Tab.


If you are using the VSCodeVim extension, you can use the Vim key shortcuts:

Next tab: gt

Prior tab: gT

Numbered tab: nnngt


Windows

previous

Ctrl + Shift + Tab

Next

Ctrl + Tab

Mac OS

previous

Shift+ Cmd + [

Next

Shift + Cmd + ]


I couldn't find a post for VS Community, so I'll post my solution here.


First, you need to go to Tools -> Options -> Environment -> Keyboard, then find the command Window.NextTab. Near the bottom it should say "Use new shortcut in: ". Set that to Global (should be default), then select the textbox to the right and hit Ctrl + Tab. Remove all current shortcuts for the selected command, and hit Assign. For Ctrl + Shift + Tab, the command should be Window.PreviousTab.

Hope this helps :) If there's a separate post for VS Community, I'd gladly move this post over.


@Combii I found a way to swap

CMD+1, CMD+2, CMD+3 with CTRL+1, CTRL+2, CTRL+3, ...

In macOS, go to:

Code > Preferences > Keyboard Shortcuts

On that page, click the button on the top right of the page...

edit keybindings.json button

and append the configuration below, then save.

[
    {
        "key": "cmd+0",
        "command": "workbench.action.openLastEditorInGroup"
    },
    {
        "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"
    },
    {
        "key": "ctrl+1",
        "command": "workbench.action.focusFirstEditorGroup"
    },
    {
        "key": "ctrl+2",
        "command": "workbench.action.focusSecondEditorGroup"
    },
    {
        "key": "ctrl+3",
        "command": "workbench.action.focusThirdEditorGroup"
    }
]

You now can use CMD+[1-9] to switch between tabs and CTRL+[1-3] to focus editor groups! Hope this answer is helpful.


This also works on MAC OS:

Prev tab: Shift + Cmd + [

Next Tab: Shift + Cmd + ]


macOS - revised 2017

IN 2017, the VS CODE keyboard shortcuts have changed to CTRL+1, CTRL+2,CTRL+3 etc..to switch between tabs.

CMD+1, CMD+2, and CMD+3 switch between and create tab groups