In this post I’ll show you how to setup Gist in Sublime Text 3 Mac & Windows
Sublime Text is the most popular text / source code editor widely used in programming. Although it is a proprietary software, there are lots of free and community build plugins which can be used to extend the feature of Sublime Text. If you are not already fallen in love with Sublime Text, they you must give try.
Gist is a simple way to share snippets and pastes with others. This is one awesome service provided by Github. It allows you to store code snippets for later use, you can have as many private gists as you need and you can group multiple gist files under a single gist.
If you frequently use Gist then there is a Sublime Text plugin which helps you to use it easy way. You can manually install this Sublime Text plugin from this Gist GitHub repository.Or you can install it through Package Manager.
Generate Access Token
You will need Access Token for using Gist in Sublime text.
- Open up GitHub site.
- Go to Account Settings -> Personal access tokens
- Click “Generate new token” under “Personal access tokens”
- Enter some meaningful name in “Token description”
- Under “Select scopes”, select gist
You’ll see this just check the marked area.
Setting up in Sublime Text
- Open Sublime Text
- Go to Preferences -> Package Settings -> Gist -> Settings – User
You will have to do some configuration before you can use it. In ‘token’, you will be to put access token you just generated. In ‘include_users’, put your GitHub ID
Here is a sample settings.
Here are some options which you can configure. For details, you can check the default settings(Go to Preferences -> Package Settings -> Gist -> Settings – Default )
Using Gist in Sublime Text 3
You can find all functionality of the Gist plugin under Tools -> Gist menu and in the command palette.
Use the Gist -> Create Public Gist or Gist -> Create Private Gist commands. If you don’t have anything selected, a Gist will be created with contents of current file, URL of that Gist will be copied to the clipboard and then the file will switch to Gist editing mode. If you have selected some text, a Gist will be created using only that text and then immediately opened for editing. In case of multiple selections, you’ll get one Gist with multiple files.
Use the Gist -> Open Gist command to see a list of your Gists. Selecting one will open the files from that Gist in new tabs. You can then edit the files normally and save to update the Gist, or use other commands to change Gist description, remove or rename files, or delete the Gist.
|Windows and Linux||OS X|
|Create Public Gist||Ctrl+K Ctrl+I||Super+K Super+I|
|Create Private Gist||Ctrl+K Ctrl+P||Super+K Super+P|
|Update File||Ctrl+K Ctrl+S||Super+K Super+S|
|Open File||Ctrl+K Ctrl+O||Super+K Super+O|
|Insert File||Ctrl+K Ctrl+[||Super+K Super+[|
|Add File||Ctrl+K Ctrl+]||Super+K Super+]|
If you have any question just drop me a line in comments. I’ll be happy to help! 🙂