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

Re: Multi-Line Tabbar for ST2

Postby cricrazy on Tue Jan 20, 2015 10:28 pm

Great work. I know it is not the complete solution, but I would take it as an interim solution. It allows me to view filenames easily. Heck...I use three rows as a way to sort files from three different projects too!!!

Thanks. It has crashed on me some times, but I am ok with that.

Thanks again.
Posts: 2
Joined: Fri Oct 25, 2013 6:33 pm

Re: Multi-Line Tabbar for ST2

Postby valerij_ on Wed Jan 21, 2015 6:45 pm

neat hack,
i guess by hooking `EventListener.on_activate` to detect the click on a tab and using `Window.set_view_index` to move the tab to lowest pane you should be able to mimic multiline tabbar behaviour really close
Posts: 53
Joined: Fri Feb 14, 2014 5:59 pm

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 12 guests