Home Download Buy Blog Forum Support

Is it possible to save layouts / tab groupings?

Is it possible to save layouts / tab groupings?

Postby MikeJerome on Thu Apr 19, 2012 11:58 pm

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.
MikeJerome
 
Posts: 11
Joined: Mon Apr 02, 2012 7:40 am

Re: Is it possible to save layouts / tab groupings?

Postby bizoo on Mon Apr 23, 2012 7:57 pm

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.
bizoo
 
Posts: 874
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Is it possible to save layouts / tab groupings?

Postby madeingnecca on Wed Dec 19, 2012 8:08 pm

@MikeJerome
I needed a similar functionality and I wrote a plugin: https://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.
madeingnecca
 
Posts: 2
Joined: Wed Dec 19, 2012 7:59 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot] and 25 guests