visual-studio-code

Open files in left or right-most editor group in VS code


Is there a means to always open files chosen in VS Code's file explorer in a particular code editor group, say the left or right-most group?

I can use "Open to the side" (Ctrl-Enter) to open a file in a new group, to the right. Otherwise a file opens (in preview or otherwise) in the currently active group. This can be annoying, because often I'm working on a file in the active group, and want to refer to another file in a side group which I already have open (with another file in it), rather than a new side group. I have to activate the side group first, and then open the file I want to see: but I usually forget which group is active, and open the file I want to look at in place of the one I was editing...

I can use Ctrl-1, Ctrl-2 etc to switch to a group before opening a file: but I'd rather be able to use the file explorer as a GUI to explore files, without having to think: if I could "pin" the file explorer to a given editor group, it would be simpler.


Solution

  • What you can do is lock the group where your reference file is - for example on the right side - by clicking on the three dots within that group and then clicking Lock group, as shown:

    Image for lock group setting

    This will make sure that no new files are opened in that group, but instead will be opened in your other group, on the left side.