Hello, I am preparing to write a simple (I hope) plugin for Sublime Text and I was hoping to receive a little feedback on my planned approach before I get started.
Goal: Using a keybind (e.g. ctrl+shift+x) drop into a mode where my regular keys are all bound to snippets.
For example,
pressing ‘a’ activates snippet 1,
pressing ‘b’ activates snippet 2,
…
pressing ‘z’ activates snippet 26, and so on.
I was thinking of approaching this problem by writing several commands that insert the snippets like so:
class ExampleCommand(sublime_plugin.TextCommand):
def run(self, edit):
contents = 'snippet contents'
self.view.run_command('insert_snippet', {"contents": contents})
and creating one additional command that dynamically binds/unbinds the regular character keys to the commands.
I am particularly unsure if that last command is a good idea. I am unsure if it can be done and, possibly more importantly, if it can be, whether it should be done or not.
Any feedback for this first-time plugin writer is very appreciated.