gist

command module
v2.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gist

Read and edit your GitHub Gists from the terminal.

gist

It opens your gists in a list, with the files of the one under the cursor below it, and a CLI does the same from a script:

  • the files drawn with their syntax, and Markdown rendered
  • a filter, fuzzy over what you type, with file:, lang:, vis:, owner: and desc: to look in one thing, size:>200KB, updated:<7d and comments:>0 to go by size, age and comments, and tab to fill them in
  • edits in your own editor, with the diff to read before anything is pushed, and a draft kept if you stop there
  • a push that stops when the gist changed on GitHub since you opened it
  • the gists you starred, and their comments
  • the lists kept from the last launch, shown at once and then read again

The page says the same in short.

Install

With Homebrew:

brew install babarot/tap/gist

With Nix:

nix profile install github:babarot/nur-packages#gist

With Go:

go install github.com/babarot/gist/v2@latest

Or take a binary from the releases.

gist reads GitHub with the account gh is logged in to (gh auth login), or with GH_TOKEN or GITHUB_TOKEN. The token needs the gist scope to change gists. gist auth says where it found one and what it can do.

Keys

? lists every key, and the line at the bottom shows the ones that work where you are. A few to start with:

Key
j k, h l move, go to the previous or next file
enter edit the file in your editor, then read the diff and push it
n, D a new gist, delete
space, V, u select gists for D to delete together, select all shown, clear the selection
E, r change the description, rename the file
y, Y copy the URL, copy the file
/ filter
1 2 your gists, the ones you starred
c, m the comments, Markdown as written
J K, + - scroll the preview, change its height

Keys are bound by the name of their action, and can be changed in the config file.

Commands

Every command works without a terminal, and a gist is named by its ID, its URL, or a file in it.

gist list --public --json          # your gists, as JSON
gist view 1a2b3c main.go           # a file as it is written
gist new --public main.go go.mod   # a gist, printing its URL
echo hello | gist new -f hello.txt
gist edit 1a2b3c main.go           # in your editor
sed s/a/b/ main.go | gist edit 1a2b3c main.go
gist edit 1a2b3c --add go.sum --rename old.go=new.go -d 'a new description'
gist delete 1a2b3c --yes
gist open 1a2b3c
gist clone 1a2b3c

gist --help lists them all, and gist <command> --help their flags.

Config

The first launch writes ~/.config/gist/config.toml (or under $XDG_CONFIG_HOME), with every setting in a comment. A setting left out takes its default.

Setting Default
editor "" the editor; empty uses $VISUAL, then $EDITOR, then vi
theme "auto" "auto" follows the terminal's background; "default" is dark, "latte" light
new.visibility "secret" what a new gist is: "secret" or "public"
list.lead "file" the first column: "file", or "description" alone, with a FILES column
preview.markdown "rendered" how .md files show: "rendered", or "plain" as written
[keys] the keys of an action, such as quit = ["q"]

gist config check reads the file and prints its mistakes, each where it is, without starting.

A release build looks for a newer release once a day; set GIST_NO_UPDATE_CHECK to turn that off.

Files

~/.config/gist/config.toml the config file
~/.cache/gist the lists and the contents last read
~/.local/state/gist drafts, the preview's height, the log (gist log prints where)

Each follows its XDG_*_HOME when set.

Development

mise run test    # the tests, with the race detector
mise run lint    # golangci-lint
mise run demo    # record docs/demo.gif with VHS in Docker

docs/architecture.md shows how the packages are layered.

License

MIT

Documentation

Overview

gist edits your GitHub Gists from the terminal.

Directories

Path Synopsis
demo
internal/recording
Package recording runs the TUI against a made-up GitHub, for the recording in the README.
Package recording runs the TUI against a made-up GitHub, for the recording in the README.
recording command
recording runs gist against a made-up GitHub, for the recording in the README: mise run demo records it.
recording runs gist against a made-up GitHub, for the recording in the README: mise run demo records it.
screens command
screens walks gist against a made-up GitHub of its own, pressing its keys, and writes every screen it comes to, with what each key leads to.
screens walks gist against a made-up GitHub of its own, pressing its keys, and writes every screen it comes to, with what each key leads to.
internal
app
Package app puts gist together: the commands and their flags, the log, and what each command is given to run with.
Package app puts gist together: the commands and their flags, the log, and what each command is given to run with.
cache
Package cache keeps what was read from GitHub, so the next launch shows it at once and asks only for what changed.
Package cache keeps what was read from GitHub, so the next launch shows it at once and asks only for what changed.
cli
Package cli holds what the subcommands do, once internal/app has parsed their arguments.
Package cli holds what the subcommands do, once internal/app has parsed their arguments.
config
Package config reads the config file: what the user can set, each with a default, so a file that sets nothing is a file that works.
Package config reads the config file: what the user can set, each with a default, so a file that sets nothing is a file that works.
diff
Package diff says what changed between two versions of a file, with three lines of context around each change.
Package diff says what changed between two versions of a file, with three lines of context around each change.
edit
Package edit is how a gist is changed, shared by the CLI and the TUI: it holds the gist's lock, knows the revision a change was based on, keeps an edit as a draft until it is sent, and checks the gist did not move underneath it.
Package edit is how a gist is changed, shared by the CLI and the TUI: it holds the gist's lock, knows the revision a change was based on, keeps an edit as a draft until it is sent, and checks the gist did not move underneath it.
fakegist
Package fakegist is a made-up GitHub Gist API for tests: an httptest server a client reaches through Transport, whatever host it asks for.
Package fakegist is a made-up GitHub Gist API for tests: an httptest server a client reaches through Transport, whatever host it asks for.
filter
Package filter narrows the list of gists: words found in order in a gist's description or file names, and key:value terms that look in one thing only: file:, desc:, vis:, lang:, owner:, size:, updated: and comments:.
Package filter narrows the list of gists: words found in order in a gist's description or file names, and key:value terms that look in one thing only: file:, desc:, vis:, lang:, owner:, size:, updated: and comments:.
github
Package github is gist's only way to GitHub: it reads and writes gists through the REST API, with the token go-gh finds.
Package github is gist's only way to GitHub: it reads and writes gists through the REST API, with the token go-gh finds.
highlight
Package highlight splits a file into lines of tokens, with what each token is rather than its color, which is for the theme to say.
Package highlight splits a file into lines of tokens, with what each token is rather than its color, which is for the theme to say.
logging
Package logging makes the logger gist writes its log file with: JSON lines through log/slog, to a file under the state directory, never to the terminal the TUI draws on.
Package logging makes the logger gist writes its log file with: JSON lines through log/slog, to a file under the state directory, never to the terminal the TUI draws on.
markdown
Package markdown draws Markdown in lines of a given width, with what each piece of text is rather than its color, which is for the theme to say.
Package markdown draws Markdown in lines of a given width, with what each piece of text is rather than its color, which is for the theme to say.
model
Package model holds the types the other packages share: gists, their files and comments, as gist uses them rather than as GitHub sends them.
Package model holds the types the other packages share: gists, their files and comments, as gist uses them rather than as GitHub sends them.
near
Package near finds, among a few names, the one closest to a name that was mistyped, so a message can ask "did you mean ...?".
Package near finds, among a few names, the one closest to a name that was mistyped, so a message can ask "did you mean ...?".
release
Package release tells whether a newer release of gist is out and how the running install is updated.
Package release tells whether a newer release of gist is out and how the running install is updated.
resolve
Package resolve turns what the user calls a gist into its ID.
Package resolve turns what the user calls a gist into its ID.
state
Package state keeps what would be missed if lost: the drafts of edits not yet sent, and the locks that keep two gist from one gist's drafts.
Package state keeps what would be missed if lost: the drafts of edits not yet sent, and the locks that keep two gist from one gist's drafts.
text
Package text makes text from GitHub fit to draw.
Package text makes text from GitHub fit to draw.
tui
Package tui is gist's terminal UI.
Package tui is gist's terminal UI.
tui/keymap
Package keymap binds keys to actions by name.
Package keymap binds keys to actions by name.
tui/statusline
Package statusline holds what the status line shows: what just happened, for a moment, and what is going on.
Package statusline holds what the status line shows: what just happened, for a moment, and what is going on.
version
Package version holds the release version.
Package version holds the release version.
xdg
Package xdg says where gist keeps its files, following the XDG base directory specification.
Package xdg says where gist keeps its files, following the XDG base directory specification.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL