Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 40 lines (33 sloc) 1.136 kb
747e13d6 » Dominique Wahli
2012-05-31 Add automatic sort when loading/saving.
1 import sublime, sublime_plugin
1f15e144 » Dominique Wahli
2012-10-01 Add 'repeat last sort' and 'close last tabs' commands, add Sort Tabs …
2 import time
747e13d6 » Dominique Wahli
2012-05-31 Add automatic sort when loading/saving.
3
20185eec » facelessuser
2013-03-19 ST3 support
4 ST3 = int(sublime.version()) >= 3000
5
6 if ST3:
4dfe83a9 » facelessuser
2013-12-28 - (ST3) rename SortTabs as sort_tabs
7 import SortTabs.sort_tabs as sort_tabs
aa92e3c7 » Dominique Wahli
2013-12-30 Oups, last commit didn't works well ;(
8 from SortTabs.sort_tabs import settings, internal_settings
20185eec » facelessuser
2013-03-19 ST3 support
9 else:
10 import sort_tabs
aa92e3c7 » Dominique Wahli
2013-12-30 Oups, last commit didn't works well ;(
11 from sort_tabs import settings, internal_settings
747e13d6 » Dominique Wahli
2012-05-31 Add automatic sort when loading/saving.
12
13
14 class AutoSortTabsListener(sublime_plugin.EventListener):
15 def on_load(self, view):
aa92e3c7 » Dominique Wahli
2013-12-30 Oups, last commit didn't works well ;(
16 if settings().get('sort_on_load_save'):
5bff4404 » Dominique Wahli
2012-06-12 Fix auto sorting with ctrl+p and click on the treelist (Issue #1 and …
17 if not self._run_sort(view):
18 view.settings().set('sorttabs_tosort', True)
747e13d6 » Dominique Wahli
2012-05-31 Add automatic sort when loading/saving.
19
20 def on_post_save(self, view):
aa92e3c7 » Dominique Wahli
2013-12-30 Oups, last commit didn't works well ;(
21 if settings().get('sort_on_load_save'):
5bff4404 » Dominique Wahli
2012-06-12 Fix auto sorting with ctrl+p and click on the treelist (Issue #1 and …
22 self._run_sort(view)
23
24 def on_activated(self, view):
1f15e144 » Dominique Wahli
2012-10-01 Add 'repeat last sort' and 'close last tabs' commands, add Sort Tabs …
25 view.settings().set('sorttabs_lastactivated', time.time())
aa92e3c7 » Dominique Wahli
2013-12-30 Oups, last commit didn't works well ;(
26 if settings().get('sort_on_load_save'):
5bff4404 » Dominique Wahli
2012-06-12 Fix auto sorting with ctrl+p and click on the treelist (Issue #1 and …
27 if view.settings().get('sorttabs_tosort'):
28 if self._run_sort(view):
29 view.settings().erase('sorttabs_tosort')
747e13d6 » Dominique Wahli
2012-05-31 Add automatic sort when loading/saving.
30
31 def _run_sort(self, view):
5bff4404 » Dominique Wahli
2012-06-12 Fix auto sorting with ctrl+p and click on the treelist (Issue #1 and …
32 if view.window() and view.window().get_view_index(view)[1] != -1:
aa92e3c7 » Dominique Wahli
2013-12-30 Oups, last commit didn't works well ;(
33 cmd = settings().get('sort_on_load_save_command')
1f15e144 » Dominique Wahli
2012-10-01 Add 'repeat last sort' and 'close last tabs' commands, add Sort Tabs …
34 if not cmd:
35 # Last used sort
aa92e3c7 » Dominique Wahli
2013-12-30 Oups, last commit didn't works well ;(
36 cmd = internal_settings().get('last_cmd')
5bff4404 » Dominique Wahli
2012-06-12 Fix auto sorting with ctrl+p and click on the treelist (Issue #1 and …
37 if cmd:
38 view.window().run_command(cmd)
39 return True
40 return False
Something went wrong with that request. Please try again.