Is there a quick change tabs function in Visual Studio Code?

后端 未结 18 1641
星月不相逢
星月不相逢 2020-12-07 06:26

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 moder

相关标签:
18条回答
  • 2020-12-07 07:21

    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"
        }
    ]
    
    0 讨论(0)
  • 2020-12-07 07:22

    By default, Ctrl+Tab in Visual Studio Code cycles through tabs in order of most recently used. This is confusing because it depends on hidden state.

    Web browsers cycle through tabs in visible order. This is much more intuitive.

    To achieve this in Visual Studio Code, you have to edit keybindings.json. Use the Command Palette with CTRL+SHIFT+P, enter "Preferences: Open Keyboard Shortcuts (JSON)", and hit Enter.

    Then add to the end of the file:

    [
        // ...
        {
            "key": "ctrl+tab",
            "command": "workbench.action.nextEditor"
        },
        {
            "key": "ctrl+shift+tab",
            "command": "workbench.action.previousEditor"
        }
    ]
    

    Alternatively, to only cycle through tabs of the current window/split view, you can use:

    [
        {
            "key": "ctrl+tab",
            "command": "workbench.action.nextEditorInGroup"
        },
        {
            "key": "ctrl+shift+tab",
            "command": "workbench.action.previousEditorInGroup"
        }
    ]
    

    Alternatively, you can use Ctrl+PageDown (Windows) or Cmd+Option+Right (Mac).

    0 讨论(0)
  • 2020-12-07 07:26

    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!

    0 讨论(0)
  • 2020-12-07 07:26

    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.

    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).

    0 讨论(0)
  • 2020-12-07 07:27

    This also works on MAC OS:

    Prev tab: Shift + Cmd + [

    Next Tab: Shift + Cmd + ]

    0 讨论(0)
  • 2020-12-07 07:30

    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.

    0 讨论(0)
提交回复
热议问题