Skip to content

Instantly share code, notes, and snippets.

@alaingilbert
Created August 25, 2016 19:56
Show Gist options
  • Save alaingilbert/abc8ef9b4b30f4ef1cc23cb598dc07f4 to your computer and use it in GitHub Desktop.
Save alaingilbert/abc8ef9b4b30f4ef1cc23cb598dc07f4 to your computer and use it in GitHub Desktop.
import re
import sublime
import sublime_plugin
import SublimeREPL.sublimerepl
import SublimeREPL.text_transfer
class RefreshNamespacesInReplCommand(SublimeREPL.text_transfer.ReplTransferCurrent):
def run(self, edit):
ns = re.sub("ns\s*", "", self.view.substr(self.view.find("ns\s*\S+",0)))
text = "(require '%s :reload)" % ns
self.view.window().run_command("repl_send", {"external_id": self.repl_external_id(), "text": text})
text = "(curbside.api.runtime/stop!)"
self.view.window().run_command("repl_send", {"external_id": self.repl_external_id(), "text": text})
text = "(curbside.api.runtime/start!)"
self.view.window().run_command("repl_send", {"external_id": self.repl_external_id(), "text": text})
// Key bindings user:
{ "keys": ["alt+super+r"], "command": "refresh_namespaces_in_repl"},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment