Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 721
yodalr Avatar asked Aug 15 '16 14:08

yodalr


People also ask

How do I switch between tabs in Visual Studio?

Hold down the Ctrl key and press Tab repeatedly until you select the file you intend to switch to.

How do I enable quick fixes in VS Code?

Clicking on the Code Action lightbulb or using the Quick Fix command Ctrl+. will display Quick Fixes and refactorings. If you'd just like to see refactorings without Quick Fixes, you can use the Refactor command (Ctrl+Shift+R).

Where is quick open in VS Code?

Quick file navigation# Tip: You can open any file by its name when you type Ctrl+P (Quick Open).


2 Answers

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

like image 184
SC_Chupacabra Avatar answered Sep 22 '22 15:09

SC_Chupacabra


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

like image 41
yiyuan lv Avatar answered Sep 23 '22 15:09

yiyuan lv