Hi folks,
I work with ST2 for one week now (coming from Notepad++) and the only thing really annoying me, is that the titles of the tabs are truncated when a lot of tabs are open and there is no multi row tab layout. So I used the ST layout to provide a hacky kind of multiple line tabs:
import sublime, sublime_plugin
multi_col_layout = 1
bar_height = 0.025
class MultiColumnTabBarCommand(sublime_plugin.EventListener):
def on_activated(self, view):
a = sublime.active_window()
b = a.get_view_index(view)
if (b[0] == 0) and (multi_col_layout == 1):
a.run_command("set_layout",{"cols":[0.0,1],"rows":[0.0,bar_height,bar_height*2,1],"cells":[0,2,1,3],[0,0,1,1],[0,1,1,2]]})
if (b[0] == 1) and (multi_col_layout == 1):
a.run_command("set_layout",{"cols":[0.0,1],"rows":[0.0,bar_height,bar_height*2,1],"cells":[0,0,1,1],[0,2,1,3],[0,1,1,2]]})
if (b[0] == 2) and (multi_col_layout == 1):
a.run_command("set_layout",{"cols":[0.0,1],"rows":[0.0,bar_height,bar_height*2,1],"cells":[0,0,1,1],[0,1,1,2],[0,2,1,3]]})
class ToggleMultiColLayoutCommand(sublime_plugin.TextCommand):
def run(self,edit):
global multi_col_layout
if (multi_col_layout == 1):
multi_col_layout = 0
print "Multi Col Layout disabled"
elif (multi_col_layout == 0):
multi_col_layout = 1
print "Multi Col Layout enabled"
https://docs.google.com/uc?export=download&id=0B6wrxUDLue4IWm9TS1hHVjkteEU
This is a quite static approach to provide a 3 row tab layout. The main idea is to set up a 3 row layout and only show one tab group whereas only the top of the other tabgroups is shown above. On click on a tab of another group, the active group is changed and shown whereas the others go to background.
Known issues are:
- the height of a tab row is dependent on screen resolution and window size; can be manually adjusted using the bar_height variable
- goto anything opens a file in the focussed tab group although it is already open in another group
- 3 static rows
- tabs have to be distributed to tab rows manually (i.e. drag and drop)
- not compatible to own layouts (split column,…), therefore can be disabled by toggle_multi_col_layout command
-…
For me it is fine like this and maybe it is helpful for someone else, but of course I would also appreciate if there is a Python/ST expert who can make this more flexible.
Best regards,
wwwweb