Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • Go to Definition on a symbol (which often opens a new file in the same editor group)
  • Open this newly opened file in a editor group next to current
  • ... and switch back to the original file

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

like image 972
Hennadii Omelchenko Avatar asked Feb 16 '17 18:02

Hennadii Omelchenko


People also ask

How do I open a Visual Studio Code in a different folder?

On the Visual Studio menu bar, choose File > Open > Folder, and then browse to the code location. On the context (right-click) menu of a folder containing code, choose the Open in Visual Studio command.


2 Answers

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
like image 52
Shaun Luttin Avatar answered Oct 22 '22 04:10

Shaun Luttin


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

Then adding Alt to the combination may do the trick. My VSCode version is 1.60.

!IMPORTANT: The new tab opened via Ctrl + Alt + Click, will always be to the right of the current. 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.

like image 29
Eugene Avatar answered Oct 22 '22 05:10

Eugene