Skip to content

Instantly share code, notes, and snippets.

@OdatNurd
Created November 2, 2020 07:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OdatNurd/2aeb8f753a053d9b927a8f125a8e456d to your computer and use it in GitHub Desktop.
Save OdatNurd/2aeb8f753a053d9b927a8f125a8e456d to your computer and use it in GitHub Desktop.
Simple plugin to make working with side by side builds in Terminus easier
import sublime
import sublime_plugin
class CloseTerminusViewByTitleCommand(sublime_plugin.WindowCommand):
"""
Close all terminus views in the current window that have the title
provided.
"""
def run(self, title):
current = self.window.active_view()
for view in self.window.views():
if view.name() == title:
view.run_command('terminus_close')
self.window.focus_view(current)
class WindowFocusCommand(sublime_plugin.WindowCommand):
"""
Store the current selected group of files and which file is active in that
group, and later restore that selection.
"""
group = None
index = None
def run(self, store):
if store:
view = self.window.active_view()
self.group, self.index = self.window.get_view_index(view)
else:
if self.group is not None and self.index is not None:
view = self.window.views_in_group(self.group)[self.index]
self.window.focus_group(self.group)
self.window.focus_view(view)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment