Sublime Forum

Visual cues to organize tabs by file path or repo

#1

I keep multiple clones of the same repository open in one folder, and open files from multiple clones at once. Over time, I have files from different clones and branches open as tabs in the same Sublime window. For example:
/path/to/repo/cloneA/foo/bar/baz.txt
/path/to/repo/cloneA/foo/baz/bar.py
/path/to/repo/cloneB/foo/bar/baz.txt
/path/to/repo/cloneC/foo/spam/blah.cpp

It would be helpful to have a visual indication of which clone a given file belonged to. I can tell the difference between the two tabs where baz.txt is open; they’ll say cloneA and cloneB in the title. But I want a way to quickly tell which clone the other files belong to. For example, showing “cloneX” in the tab title or coloring all tabs belonging to cloneX the same color.

Does anyone know whether there are tools in the API to build such a plugin?

0 Likes

#2

You can’t directly fiddle with the display of a tab[1], but you can alter the color of the tab with a little work. Specifically, the color of the tab is based on the background color used in the color scheme, and the color_scheme setting is one that can be set on a per-view basis. So you could make a few copies of your current color scheme with slightly different (but distinct) background colors and have a plugin apply them on_load based on the path that the file is loaded from.

The downside to this would be that the background of the editing area is affected as well, so whatever colors you choose need to still be something that allows you to see and work with the content of the file, which may or may not be an issue.

[1]: This is actually a lie; you can fiddle the text of the tab if you want, but when you do that it makes Sublime think that’s the name of the file, which has various unfortunate side effects. You might be able to work around them (and there might actually be a package that already tries to do this), but I think the color idea is probably a better one.

0 Likes

#3

It seems like I could create an EventListener plugin that sets a tab’s color_scheme on load based on its file path, but switches to the default color scheme when the tab is activated and back again on deactivation.

0 Likes

#4

Indeed, you could do that as well if you like; though you would lose the color context information for knowing where the currently active file is stored, but that’s probably less important than being able to actually see the file contents.

0 Likes

#5

I’m a n00b using Rails - it would be nice to be able to right click a folder and select ‘Create a folder tab’.

Folder tab means that any files opened from within that folder goes to the right of the folder tab. If I click on the folder tab, it opens (to the right) all the tabs of opened files within that folder, and when I click it again, the file tabs hide. If you create a folder tab of a folder that is inside a folder that also has a tab, then that folder tab would go inside the parent folder tab (and cannot escape). File tabs also cannot escape folder tab. Files of non-folder tabs would open to the right of folder tabs. If you close a folder tab, all file tabs are also closed. You should be able to arrange folder tabs as necessary, providing child folder tabs are not able to escape parent folder tabs.

That would speed up my productivity I think. Folder tab for the controllers folder, models folder and views folder, and then individual view folders inside the views folder, for whatever I’m working on at the time.

0 Likes