Hello. I thought I would re-post the following TextCommand here. Assign it a key-binding and it will sort all open tabs alphabetically (case-insensitive). It sorts within groups as well.
[code]import sublime, sublime_plugin, os
from operator import itemgetter
class SortTabsCommand(sublime_plugin.TextCommand):
def run(self, edit):
file_views = ]
win = self.view.window()
curr_view = win.active_view()
for vw in win.views():
, tail = os.path.split(vw.file_name())
group, _ = win.get_view_index(vw)
file_views.append((tail.lower(), vw, group))
file_views.sort(key = itemgetter(2, 0))
for index, (, vw, group) in enumerate(file_views):
if not index or group > prev_group:
moving_index = 0
prev_group = group
else:
moving_index += 1
win.set_view_index(vw, group, moving_index)
win.focus_view(curr_view)[/code]
It’s available as a Gist as well gist.github.com/1995854
Someone may have already created this in the past - I haven’t checked . Andy.