Home Download Buy Blog Forum Support

Multi-Line Tabbar for ST2

Multi-Line Tabbar for ST2

Postby wwwweb on Wed Apr 09, 2014 4:26 pm

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:

Code: Select all
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):

    if (b[0] == 1) and (multi_col_layout == 1):

    if (b[0] == 2) and (multi_col_layout == 1):

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"


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,
Posts: 1
Joined: Wed Apr 09, 2014 4:09 pm

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 7 guests