Sublime Forum

Is it possible to save layouts / tab groupings?

#1

How can I save my tab groupings when switching between layouts? Lets say I have 10 files open and I am using a 2-column view layout with 5 files in the tab-groups of each column. If I change the layout and then change it back again to 2-columns, all the tabs are now in the left column and the other is empty meaning I have to move them all over again.

0 Likes

Is it possible to automatically save layouts / tab groupings?
#2

ST2 keep the content of the groups when you change layout as long as your new layout as the same or more groups.
If you switch from a 2 columns layout to a 3 lines layout and come back to 2 columns layout you will see that it works.
But if you switch from a 2 columns layout to a single columns layout discard the content of the second group.

I’m pretty sure it’s possible to save the layout using a plugin:

  1. Create your own set_layout command.
  2. Use API method view.get_view_index() or window.views_in_group() to store the group index in the view.settings() for each view except views that have already a group index in the view.settings() greater than the actual number of group.
  3. Call the standard set_layout command.
  4. Use API method view.set_view_index() to put views back to the right group.
1 Like

#3

@MikeJerome
I needed a similar functionality and I wrote a plugin: github.com/madeingnecca/sublime-layout-zoom .
The only difference is that I only needed to “zoom” on a single layout, and then to restore the previous layout.
However you can browse the source code and modify it according to your needs; for example you can write a “save layout” command, switch layout and then run a “restore layout” command. Just to let you know this is possible via st2 api.

@bizoo
Before writing this plugin I read your answer and it has been inspiring. Thanks.

0 Likes