Sublime Forum

Split windows within tabs - VIM way

#1

Currently when we split a window, each panel will be a group of tabs. This is fine with large screen, or when we want to have to groups of files side by side. However, for small screen, the group of tabs get stacked in narrow panels. Also sometimes we just need to quickly split a file to see different parts at the same time.

I find split in VIM work better in this case. When we split a file, just the panel inside the tab get split, and the tab layout remained unchanged. When we’re done, we can remove the split, now the two panels will merge into 1 tab (if they’re the same file), or span into different tabs (if they’re different files).

I think maintain both ways of splitting (splitting into groups of tabs as present, or splitting into panels within tab) is the best

2 Likes

#2

Can you present some VIM screenshots?

May be you could also open it on the core issue tracker:

  1. https://github.com/SublimeTextIssues/Core/issues
0 Likes

#3

If you use Vim emulation then try NeoVintageous. You can split views similar to the way you in can in Vim e.g. ctrl+w s and ctrl+w v.

Note that there is a dependency on Origami so install that plugin too.

Also be sure to enable CTRL key modifiers because they are disable by default (I hope to change this in a later version), Preferences > Settings:

{
    "vintageous_use_ctrl_keys": true
}
1 Like

#4

Here is a VIM screenshot

As you can see, the VIM instance has 2 tabs, within the first tab there 5 panes
The 2nd tab will have it own set of panes/window splits

I find this more lightweight than Sublime way, because the VIM pane take less space, while the tab is native window element, it take more space. It’s very convenient when you want to temporarily split a window to 2 panes side by side for to refer content or compare content, then switch back to single window.

2 Likes

#5

I wish ST had a feature like that…

0 Likes

#6

My understanding is that your main concern is the visual space of the Sublime Text file tabs.

You can replicate the VIM screenshot on macOS by using Sierra tabs (cmd+alt+shift+n) to create a new Sublime Text tab (technically it will be two Sublime Text windows presented within OS tabs). Then in each, use View > Hide Tabs. Once that is done, you can use the View > Layout and View > Groups menus to split as desired.

1 Like

#7
  • Tabs in Vim are like Windows in ST
  • Windows in Vim are like Groups in ST
  • Buffers in Vim are like Tabs in ST

Tabs might not look like buffers until you hide them: Menu > View > Hide Tabs. In NeoVintageous you can use gt to cycle through the tabs or “buffers”.

There are some obvious differences and some quirky differences.

I think what you’re looking for to open up your project twice, i.e. in different windows, except the windows would be tabs.

I like Vim’s windowing system and I like ST’s. They both have their pros and cons. I think a lot of users would probably find Vim’s window system a little confusing, especially the buffers.

1 Like

#8

and for users who are not on macOS ? :slight_smile:

0 Likes

#9

You won’t get OS tabs, but you can hide Sublime Text tabs within a window if you don’t like the extra real-estate they take up. On Windows and Linux the current filename will be in the title bar, and you can use View > Side Bar > Show Open Files to see your list of open files above your list of folders.

0 Likes

#10

@wbond This particular issue has been a concern of mine for quite some time. Editing because accidentally hit Tab before Space, which posted early

Basically, sublime puts buffers (manifested as tabs) “inside” splits, whereas VIM (and Emacs) manage buffers at the level of a window, and splits are within that. The critical practical distinction is that you can split as many times as you want, and you have the same buffer set everywhere. Closing a buffer in one split closes it in the others. Opening a buffer in one split opens it in the others (though, traditionally does not give it focus in anything but the one you’re currently working in). There is no notion of a split pane which has anything less or more than the same set of buffers that are in all other splits.

Origami does a good job, but it is fundamentally incapable of emulating this element of VIM/Emacs buffer splits, which is deeply, deeply unfortunate and results in a split pane functionality which I find considerably less useful than it otherwise could be.

So it’s not really about space loss; it’s about how we interact with the editor and the model we need to keep of splits. With “the Sublime way”, I have to keep track of which buffers are open where. If I want the same file in multiple places, I have to copy the buffer. Unsplitting with dirty buffers can actually prompt me to save, which is intensely unintuitive. With “the Emacs way”, I can just split whenever I want separate views into the same “set of data”, and unsplit when I don’t want those views anymore.

0 Likes

#11

Thanks for the insight.

I think each approach has its own pro/cons, but honestly I can’t think of a use case where user maintain 2 set of tabs side by side (ST way). Now and then, user may want to view different sections of a file at the same time, or see content of more than 1 files at the same time, and then switch back to no-split when they’re done. In this case VIM way is appropriate.

ST, VisualStudioCode, Atom have the same way maybe for a reason, I just not get it.

0 Likes