Thibault J
Thibault J

Reputation: 4446

In vscode, how to put editor regions inside tabs, and not the other way around?

I've been trying Visual Studio Code for a few days, and it's the first editor that I used in years that makes me feel I could switch from my beloved vim.

Now, it's hard to get used to new habits when you have years of muscle memory, but I'm trying to keep an open mind. There's one thing that's bugging me, though, and I could not find a way to get around: it's the fact that editor regions and tabs are "swapped". Let me explain:

In vscode, you define editor regions by splitting your screen, then each region can contain as many tabs as you want.

My problem is, that does not fit my workflow. Here's what my workflow used to be with vim, where regions are inside a single set of tabs (I mainly work with Django):

In a first tab, I've split my editor in half and I'm editing my models.py and forms.py side by side.

In a second tab, I've split the editor in half, I'm editing my views.py on the left hand side, and the right hand side is again split horizontaly, allowing me to edit multiple templatetags files.

In a third tab, I'm editing my main template, and I don't split the editor since the file may contain very long lines.

In a fourth tab, I'm editing several html files and the editor is split multiple times.

Etc.

That way, I can very quickly go to edit my models, then my views, then the templates, and start over in quick iterations.

With vscode, where the tabs are inside the fixed regions, not so much.

So my question is, what solution could I use? Am I missing a big feature here? Are there any extension that would allow me to get my old workflow back?

I'm also open to suggestions about new workflows.

Upvotes: 1

Views: 973

Answers (1)

ChatterOne
ChatterOne

Reputation: 3541

As @romainl pointed out: the workflow is different, it doesn't work that way with VS Code (and I know, I'm a vim user, too).

The best you can get that is vaguely close to what you're used to is to consider VS Code windows as you did with vim tabs.

To give you an idea using your example:

  • You open a VS Code window and open side by side models.py and forms.py
  • You hit Ctrl+Shift+N (or Command+Shift+N on a Mac) and open a new window. There you open your views.py on the left and split the right one horizontally for the templates.
  • You open a new window again and repeat.

This way you can switch between different layouts with Alt+Tab (or Command+Tab).

You could speed this up a bit by saving different workspace files for different files that you want open, because I think (not 100% sure) that saving the workspace also saves the layout.

There's a couple of annoying things with this approach though:

  • If you have multiple windows open in general (say, a browser, slack app and so on), they'll also appear in the list when you try to switch.
  • I'm not sure if the open folder will be remembered when opening a new window, but you can work around that by saving the workspace and opening it.

It's annoying but at least there's already a feature request about this ( https://github.com/Microsoft/vscode/issues/41486 )

Upvotes: 1

Related Questions