text: - Code: Select all
  import sublime
  import sublime_plugin
  '''
  Go back to the last view. Useful for jumping back and forth between two views
  '''
  last_view = None
  class LastViewRecorder(sublime_plugin.EventListener):
  """Keep track of last view
  """
  def on_deactivated(self, view):
  """When view is deactivated, record it
  """
  global last_view
  last_view = view
  class LastViewCommand(sublime_plugin.WindowCommand):
  """Go back to last view. Useful for jumping back and forth between two views
  with a single key press
  """
  def run(self):
  global last_view
  if last_view is not None:
  self.window.focus_view(last_view)
  It works fine, except when I bring up the console or a quick panel. I think the problem is I need to detect when I'm in the console or quick panel and not record the view. How can I do that?