Skip to content

Instantly share code, notes, and snippets.

@RichardHyde
Created January 20, 2014 22:58
Show Gist options
  • Save RichardHyde/8531089 to your computer and use it in GitHub Desktop.
Save RichardHyde/8531089 to your computer and use it in GitHub Desktop.
Post to Day One Sublime Text 2 Command
import sublime, sublime_plugin
import urllib, webbrowser
class PostToDayOneCommand(sublime_plugin.TextCommand):
def run(self, edit):
selections = self.view.sel()
selection = self.view.substr(selections[0])
url = "dayone://post?entry=%s" % urllib.quote(selection)
f = webbrowser.open(url)
self.view.replace(edit, selections[0], "")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment