Created
November 6, 2011 21:38
-
-
Save itsbth/1343537 to your computer and use it in GitHub Desktop.
Uploaded by gist.py
This file contains hidden or 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 | |
| import sublime_plugin | |
| from gist import create | |
| class UploadToGistCommand(sublime_plugin.TextCommand): | |
| def run(self, edit): | |
| if len(self.view.file_name()) > 0: | |
| try: | |
| url = create([self.view.file_name()]) | |
| sublime.set_clipboard(url.strip()) | |
| sublime.status_message("Copied URL to clipboard") | |
| except Exception, e: | |
| print e | |
| sublime.status_message("Unable to upload file") | |
| def is_enabled(self): | |
| return self.view.file_name() and len(self.view.file_name()) > 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment