By josh / May 21, 2013

Create and Open GitHub Gists from Sublime Text

I use GitHub gists when I want to save a snippet of code for easy reuse, or to save readers of my Sublime Productivity ebook from having to retype code examples.

Creating gists through GitHub’s web interface is a bit of a pain, though. I used to bounce back and forth between Sublime Text and the GitHub site a few times to tweak the formatting of my gist before I was happy with it.

Now I do the whole process without leaving Sublime, using the sublime-github plugin, and I created a video walkthrough that’ll show you how to set up and use the plugin:

Creating a Gist

Creating a new gist is as simple as highlighting the code you want to include and executing the github public gist command from the Command Palette.

The first time you run the plugin, it’ll prompt you for your GitHub credentials, which it uses to get an access token from GitHub.

Next, enter a description for your gist and a filename, and sublime-gist publishes your gist and copies the URL to your clipboard for easy sharing. Brilliant!

Managing and Sharing Your Gists

The sublime-github plugin also gives you several commands for viewing and editing your gists.

Type github in the Command Palette to view a list of all commands you can perform, which include:

  • Opening a gist in your browser
  • Copying a gist URL to the clipboard
  • Opening a gist directly in Sublime

P.S. If you use Git with Sublime, there’s another great plugin that you should be using. Sign up here for the details:

http://sublimetexttips.com/newsletter

About the author

josh

3comments
juristr - May 23, 2013

hmm…seems to work only with Sublime Text 2 so far..

Reply
    Robin - July 10, 2014

    I can confirm that! It’s working very well wit Sublime 2 but with Sublime 3, most of the commands doesn’t work. Nothing happens after choosing a command like “GitHub: Open Gist in Editor” or other commands.

    (rs)

    Reply
Click here to add a comment

Leave a comment: