condemil / gist

Sublime Text plugin for creating new Gists from selected text
MIT License
725 stars 136 forks source link

Gist

Build Status Coverage Status Package Control

A Sublime Text 3 plugin for creating and editing Gists.

Installation

Package Control

Install Package Control. Gist will show up in the package list. This is the recommended installation method.

Manual installation

Go to the "Packages" directory (Preferences / Browse Packages…). Then clone this repository:

git clone git://github.com/condemil/Gist

Generating Access Token

As of 2013-05-16, you can generate API Access Tokens via the Web UI or via the GitHub API. All other authorization methods is deprecated.

Web

Paste the token in the settings section under the token option.

API

Here's a command you can run from your terminal to generate a token via curl:

curl -v -u USERNAME -X POST https://api.github.com/authorizations --data "{\"scopes\":[\"gist\"], \"note\": \"SublimeText 2/3 Gist plugin\"}"

Where USERNAME is your Github username. Save the token generated and paste it in the settings section under the token option.

If OTP is enabled on your account, this will return 401 error code, use:

curl -v -u USERNAME -H "X-GitHub-OTP: OTPCODE" -X POST https://api.github.com/authorizations --data "{\"scopes\":[\"gist\"], \"note\": \"SublimeText 2/3 Gist plugin\"}"

Where OTPCODE is the code your authenticator app shows you.

Options

Edit the settings file (it should open automatically the first time you use a Gist command) to specify either token.

Usage

All functionality of the plugin is available in the Tools / Gist menu and in the command pallette.

Creating Gists

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.

Editing existing Gists

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.

Adding new files to existing Gists

Use the Gist / Add File To Gist command to see a list of your Gists. Selecting one will add contents of current file as a new file to that Gist and switch the file to Gist editing mode.

Default key bindings:

Create Public Gist

Create Private Gist

Update File

Open Gist

Insert Gist

Add File

Information

Source: https://github.com/condemil/Gist

Authors: Dmitry Budaev, Alexey Ermakov