Hennadii Omelchenko
Hennadii Omelchenko

Reputation: 855

Open already opened file in a different editor group in Visual Studio Code

What I am looking for is a way to do the following in Visual Studio Code:

Is there a command / key binding that would let me do 2nd bullet item?

Upvotes: 19

Views: 4862

Answers (4)

Eugene
Eugene

Reputation: 613

If you are here, like me, looking for a way to open files in the next group, by Ctrl + Click.

Then replacing Ctrl with Alt to the combination may do the trick. My VSCode version is 1.90.

!IMPORTANT: The new tab opened via Alt + Click, will always be to the right of the current in preview mode. So, if you have already opened two groups, then move the tab to the left to have new tabs at the right, otherwise it will create third group.

Upvotes: 3

Rakesh kumar
Rakesh kumar

Reputation: 37

  • In macOS you can use this key binding cmd + \
  • In Windows you can use this key binding CTRL + \

Upvotes: 2

Nathan Chappell
Nathan Chappell

Reputation: 2436

I'm pretty sure what you're looking for is a combination of the answers above. I find this works:

  • Ctrl + \ View: Split Editor
  • Ctrl + Alt + View: Move Editor into Next Group

Equivalently

  • (no default keybinding) View: Split Editor into Right Group

Caveat: if the file is already open in the other editor group, then it will be opened (not "cloned"). There may be a configuration setting to alter this behavior, but I couldn't find one quickly.

The result looks as follows. Suppose you are in some file on the left, and there is another editor group on the right (e.g. after executing Ctrl + \). After running the two commands above, then the currently open file will still be open on the left, but will also be open in the editor group on the right.

Tip: if you don't feel like assigning a keybinding, but would like to access the command (relatively) quickly, just type

  • Ctrl + Shift + P srg

Upvotes: 1

Shaun Luttin
Shaun Luttin

Reputation: 141512

Short Answer

Ctrl + Alt + does that on Windows.

Details

This is my normal flow:

  1. F12 to go to a symbol definition.
  2. Ctrl + Alt + to open the file on the right.

On Linux or iOS

Find the equivalent shortcut by opening File > Preferences > Keyboard Shortcuts (or running Open Keyboard Shortcuts in the command palette), and searching for these two commands:

  • workbench.action.moveEditorToNextGroup
  • workbench.action.moveEditorToPreviousGroup

Upvotes: 12

Related Questions