Skip to content

Instantly share code, notes, and snippets.

@bitlyfied
Created July 6, 2013 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitlyfied/5941445 to your computer and use it in GitHub Desktop.
Save bitlyfied/5941445 to your computer and use it in GitHub Desktop.
Just a basic Sublime Text 2 plugin
import sublime, sublime_plugin
class SampleCommand(sublime_plugin.TextCommand):
#############################
# Main
#############################
def run(self, edit):
self.edit = edit
self.window = sublime.active_window()
# first prompt
self.window.show_input_panel('First question', '', self.on_first_answer, None, None)
#############################
# Async Handlers
#############################
def on_first_answer(self, answer_a):
self.answer_a = answer_a
self.window.show_input_panel('Second question', '', self.on_second_answer, None, None)
def on_second_answer(self, answer_b):
self.answer_b = answer_b
self.window.show_input_panel('Third question', '', self.on_third_answer, None, None)
def on_third_answer(self, answer_c):
answers = self.answer_a + self.answer_b + answer_c
sublime.message_dialog('Your answers: ' + answers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment