Skip to content

Instantly share code, notes, and snippets.

@itsbth
Created November 6, 2011 21:38
Show Gist options
  • Select an option

  • Save itsbth/1343537 to your computer and use it in GitHub Desktop.

Select an option

Save itsbth/1343537 to your computer and use it in GitHub Desktop.
Uploaded by gist.py
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