我认为没有选择在Sublime中对侧边栏进行排序,我该怎么做?我想在alpbabetically进行排序。
答案 0 :(得分:8)
有一个崇高plugin,称为SortTabs。它适用于Sublime Text 2和3。
您可以使用Sublime Package Manger
进行安装,然后使用以下任一方法对标签进行排序:
答案 1 :(得分:3)
我找到了这个答案
如果您对选项卡进行排序,它会对侧边栏进行排序,并对选项卡进行排序
我修改了类名,但没有更好。之前的类名可能更好。
{ "keys": ["ctrl+alt+b"], "command": "sorttsortsidebar" }
http://www.sublimetext.com/forum/viewtopic.php?f=4&t=3876&start=20
import sublime_plugin
from os import path
from operator import itemgetter
# A simple command to sort current tabs alphabetically (returning focus to the
# original tab).
# Does not work with different groups or windows. Not catered for unsaved views
# (although it seems to work okay if there are any). It could be modified to
# work in these circumstances.
# { "keys": ["ctrl+alt+b"], "command": "sort_tabs" },
class SorttsortsidebarCommand(sublime_plugin.WindowCommand):
def run(self):
print("ddffd_sorttabs")
file_views = []
win = self.window
curr_view = win.active_view()
for vw in win.views():
_, tail = path.split(vw.file_name() or path.sep)
group, _ = win.get_view_index(vw)
file_views.append((tail.lower(), vw, group))
file_views.sort(key = itemgetter(2, 0))
moving_index = 0
for index, (_, vw, group) in enumerate(file_views):
if index == 0 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)