Sublime Forum

(ST3) TabsExtra

#1

Sublime Plugin with sticky tabs and more tab closing options.

By default, the commands won’t be grouped together as seen in the picture because of the way Sublime Text menus are managed. But you can optionally install a menu that overrides the Default Package’s tab context menu for sane grouping of the commands.

Also, by default TabsExtra keeps the current active tab focused, but if the active tab gets closed, TabsExtra will default to either the next left or right tab (depending how the user has it set). This is configurable.

See repo for more info.

Repo github.com/facelessuser/TabsExtra

1 Like

Pin tabs
#2

Awesome plugin!
Here is an idea: add options to close all saved tabs, all saved tabs to the left, all saved tabs to the right.

I often have many unsaved tabs (you know, ctrl+n to do short notes) and is killing me that i cannot close other tabs in one move.

0 Likes

#3

@iamntz Thanks!

That is a interesting idea. Hadn’t thought about that. I will look into it. You should post a github issue so I don’t forget.

0 Likes

#4

I was just thinking, instead of adding a bunch of redundant commands, why not a “sticky all unsaved” command?

0 Likes

#5

Because i like my little chaos i have here :smiley:

Actually sticky all tabs would do…

0 Likes

#6

Cool. The change will be pretty easy. I just need to workout a menu updating system when the format of the menu changes. I wasn’t planning on needing to update the menu…should of planned for updating the menu :smile:.

Will probably just open a message view in the editor alerting the user they need to select an “Update Default Menu” command or the “Install Override Menu” when the format changes. That is probably easiest. That way I don’t have to bother with validating whether the the menu default menu has been overridden, or they are just using the default TabsExtra menu in the User folder.

0 Likes

#7

Neat, This may looks useful for this package:
{ “command”: “reopen_last_file”,“caption”: “Undo Close Tab” },

Also, reveal (open in explorer), locate (show it on sidebar) and revert seems to be some other good suggestions.

0 Likes

#8

Undo is a good idea. At least for tab(s) that exist on disk :wink:.

Reveal and show in sidebar might be nice too. Do you think they are too redundant since they are already available in the view already? I really am kind of in the middle on this. I guess it could be optional.

Thanks for the suggestion.

0 Likes

#9

IMO (person who likes ontology :P), I believe …
The Tab context menu should be for operations related to the tabbar, and the current file.
The View Context Menu should be for operations about the content of the editor/buffer, not about the file. !

JFYI My tab context menu has been like this from some time dl.dropboxusercontent.com/u/930 … t-menu.png

0 Likes

#10

[quote=“tito”]IMO (person who likes ontology :stuck_out_tongue:), I believe …
The Tab context menu should be for operations related to the tabbar, and the current file.
The View Context Menu should be for operations about the content of the editor/buffer, not about the file. !

JFYI My tab context menu has been like this from some time dl.dropboxusercontent.com/u/930 … t-menu.png[/quote]

This makes sense from author of the sidebar menu plugin :smile:.

I like your menu setup. And I agree with your view on menus. I may borrow from your menu setup some.

The one thing I wish ST allowed that may be difficult for me to solve from a usability aspect, is that ST doesn’t allow augmentation of the menu via modifiers. One thing I would love to add is something like where you press a modifier, and the “close tabs” options change. Like hold ctrl, and now the close tabs options will close saved tabs without a warning dialog. Or hold alt, and the options now will close all tabs but saved tabs.

I was thinking about iamntz’s request, and ideally that is how I would like to approach it, but I can’t. I was thinking that a sticky all unsaved was fine, but now I want to implement close commands that will discard unsaved files automatically without that “Do you want to save?” dialog. I realized I would need yet another toggle…toggles for sticky tabs is fine, but toggling for all variants of a command would get tiresome. I am now thinking the best approach is just to use sub-menus. Though you have to navigate a level deeper, you won’t have to open the menu twice: one to toggle and one to execute. And burying the variants in a sub-menu will keep the top level from getting cluttered with multiple variants of the same command.

Close Tab
Close All
Close Others
Close to Left
Close to Right
----------------
Close Saved Tabs... ->
                                 Tab
                                 All
                                 Others
                                 To Left
                                 To Right
-----------------
Close Tabs (Discard Unsaved) ->
                                               Tab
                                               All
                                               Others
                                               To Left
                                               To Right
-----------------

I am open to suggestions. Anyone care to weigh in?

0 Likes

#11

Okay. Here is the next iteration. Nothing is committed yet.

The anything can be excluded. And the sections can be reordered via the settings file:

[pre=#232628] // Menu layout include or exclude, in whatever order you desire, the following options:
// “close”, “sticky”, “open”, “clone”, “save”, “reveal”, “path”, “revert”]
// When done, go to Preferences->Package Settings->TabsExtra and Install/Upgrade either
// the default TabsMenu or the Override Menu which overrides the “Default” package’s menu.
“menu_layout”: “close”, “sticky”, “open”, “clone”, “save”, “reveal”, “path”, “revert”][/pre]

After re-factoring this. It should be easier for me to extend if I need to, and it should be configurable enough that people can set it up how they like.

If you have any suggestions, comments, or concerns on this new iteration, let me know. I plan on pushing it out maybe in the next two or three days.

0 Likes

#12

Looks good to me!

0 Likes

#13

If I get a chance today, I will try and push it out later. It’s pretty much done. I think I just need to double check everything.

0 Likes

#14

I’ve got an idea, although it might be beyond the scope of this plugin.

It would be cool to be able to have different (customizable) coloured tabs depending the type of file. A quick glance could differentiate between CSS and PHP files, for instance.

Also, will your plugin appear in the Package Manager soon?

Good stuff :smiley:

0 Likes

#15

[quote=“Pwarts”]I’ve got an idea, although it might be beyond the scope of this plugin.

It would be cool to be able to have different (customizable) coloured tabs depending the type of file. A quick glance could differentiate between CSS and PHP files, for instance.
[/quote]

It would require a whole lot that I am just not really interested in doing with this. Tab colors is really controlled by the theme and such.

I haven’t put in a request yet, but I probably will sometime this week. I generally like to post a plugin here first and see the response from people before I make the request. If there is no interest, I usually don’t bother.

0 Likes

#16

Changes were just committed. You should be prompted to with a message explaining how to update your menus.

0 Likes

#17

Apparently in Windows, Tabs Extra would create menus with some funny characters. This was because the horizontal ellipsis (…) was getting converted wrong. Turns out, Python 3, as we all know, uses unicode for all strings. Even though the system returned “utf-8” as the default system encoding, sublime used “cp1252” as the default for all unicode strings…sigh… Not sure why, maybe I am missing something here, but anyways, I provided a quick and dirty patch for it for now.

So, if your menus are showing funny characters for “Save As…” etc., update TabsExtra, and then update your menus. That should fix it.

0 Likes

#18

Win 8.1 here. I didn’t see any issues (and works great, btw!)

0 Likes

#19

Ruh Roh, hopefully I didn’t mess it up for you in the future then…Maybe I need to see if I can detect what the default encoding used by sublime is. Maybe there is something off on my setup.

0 Likes

#20

Appears to have been a local issue for me. I had to delete a sublime-pacakge archived version and then the unpacked one started behaving normally…weird.

0 Likes