Created
July 3, 2013 10:04
-
-
Save wuub/5916788 to your computer and use it in GitHub Desktop.
plugin for automatically restarting interpreters in SublimeREPL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sublime.set_timeout
might be better thantime.sleep
:)