Skip to content

Commit 4801d9a

Browse files
committed
Update lessTabs.py
Added this feature: Execute the closing tabs command when a new one is opened.
1 parent 22fcb3d commit 4801d9a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lessTabs.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,25 @@ def run(self):
77
accessed_ls = int(SETTINGS.get('accessed_life_span'))
88

99
now = time.time()
10+
active_view = sublime.active_window().active_view()
1011

1112
for buffer in self.window.views():
1213
path = buffer.file_name()
1314

1415
if (
15-
path
16+
buffer != active_view
17+
and not buffer.is_loading()
1618
and not buffer.is_scratch()
1719
and not buffer.is_dirty()
20+
and path
1821
and os.path.exists(path) == True
1922
and now - os.path.getmtime(path) > modified_ls
2023
and now - os.path.getatime(path) > accessed_ls
2124
):
2225
self.window.focus_view(buffer)
23-
self.window.run_command('close_file')
26+
self.window.run_command('close_file')
27+
28+
class lessTabsEvents(sublime_plugin.EventListener):
29+
def on_new(self, view):
30+
if ( sublime.load_settings("lessTabs.sublime-settings").get("close_on_open_new") ):
31+
sublime.active_window().run_command("less_tabs")

0 commit comments

Comments
 (0)