Skip to content

Instantly share code, notes, and snippets.

@wuub
Created July 3, 2013 10:04
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 wuub/5916788 to your computer and use it in GitHub Desktop.
Save wuub/5916788 to your computer and use it in GitHub Desktop.
plugin for automatically restarting interpreters in SublimeREPL
import sublime, sublime_plugin
def auto_restart_repl(view):
restart_args = view.settings().get('repl_restart_args', None)
if not restart_args:
return
from SublimeREPL.sublimerepl import manager
rv = manager.repl_view(view)
if rv:
return # this was launched during this session
view.run_command('repl_restart')
def plugin_loaded():
import time
time.sleep(1.0) # code smell
for window in sublime.windows():
for view in window.views():
auto_restart_repl(view)
class AutoRestartRepl(sublime_plugin.EventListener):
def on_activated_async(self, view):
auto_restart_repl(view)
@schlamar
Copy link

schlamar commented Jul 3, 2013

sublime.set_timeout might be better than time.sleep :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment