SNIP(1)

NAME

snipA terminal snippet manager to store, search, and copy code snippets without leaving your shell — local, offline, and…

SYNOPSIS

$https://github.com/phlx0/snip/releases

INFO

100 stars
2 forks
0 views

DESCRIPTION

A terminal snippet manager to store, search, and copy code snippets without leaving your shell — local, offline, and built with Textual.

README


◆ snip

Your code snippets. In your terminal. Always.

Stop Googling the same one-liners. Stop losing clever commands to closed tabs.
snip is a fast, local, offline snippet vault that lives where you actually work.


CI GitHub release GitHub stars Python License Built with Textual Platform


snip terminal interface



Why snip?

You write a clever one-liner. You close the terminal. Three weeks later you're Googling the same thing again.

snip fixes that. It's a personal snippet vault that runs entirely in your terminal — local, offline, zero-account, instantly searchable. Open it, find what you need, yank it to your clipboard, and get back to work.

No Electron. No browser. No sync drama. Just your snippets, always there.


Install

One-liner (Linux / macOS)

curl -fsSL https://raw.githubusercontent.com/phlx0/snip/main/install.sh | bash

Creates an isolated virtualenv at ~/.local/share/snip, drops a snip launcher at ~/.local/bin/snip, and patches your shell config if needed. Open a new terminal and you're done.

From source

git clone https://github.com/phlx0/snip
cd snip
make dev    # creates .venv + installs with dev extras
make run    # launch

Usage

snip                          # open the TUI
snip ports                    # copy snippet titled "ports" to clipboard
snip run deploy               # run a snippet as a shell command
snip --list                   # print all snippet titles
snip --list docker            # filter titles by tag
snip --add myscript.sh        # save a file as a snippet
snip --delete ports           # delete a snippet without opening the TUI
snip --json ports             # output snippet as JSON (great for scripting)
snip --export > backup.json   # export all snippets to JSON
snip --import backup.json     # import snippets from JSON
snip --from-history           # pick a command from shell history and save it
snip --version                # show version
snip -q ports                 # suppress informational output (clean for scripts)
snip --db ~/sync/snippets     # use a custom snippets directory
snip theme list               # list available themes
snip theme set dracula        # switch to the Dracula theme
snip theme import my.json     # import a custom theme and activate it
snip --theme dracula          # one-shot: use a theme for this session only

Shell completion

# zsh — add to ~/.zshrc
eval "$(snip init zsh)"

bash — add to ~/.bashrc

eval "$(snip init bash)"

snip <TAB> will autocomplete snippet titles and flags.

fzf integration

snip --list | fzf | xargs snip

Pick any snippet interactively with fuzzy search, pipe it straight to your clipboard.


Features

Instant CLI lookupsnip <query> copies a snippet without opening the TUI
Run as commandsnip run <query> runs a snippet directly in your shell
Import from filesnip --add script.sh saves any file as a snippet, language auto-detected
Export / importsnip --export / snip --import — JSON backup, perfect for dotfiles
Shell history miningsnip --from-history — pick a command from your history and save it
Tag filteringsnip --list docker — filter titles by tag from the CLI
JSON outputsnip --json <query> — full snippet metadata as JSON for scripting
Shell completioneval "$(snip init zsh)" — tab-complete snippet titles and flags
fzf-friendlysnip --list prints titles one per line — pipe into anything
ThemesBuilt-in Tokyo Night and Dracula; import any custom theme via a JSON file
Syntax highlightingSyntax colors adapt to the active theme across 20+ languages
Live searchFilters across title, description, tags, and language as you type
Clipboard copyPress y to yank a snippet straight to your clipboard
Pin snippetsKeep your most-used snippets pinned at the top
TagsOrganise freely — #docker #devops #git etc.
Vim-style navigationj/k or arrow keys, / to search, q to quit
Git-friendly storageSnippets are plain Markdown files in ~/.config/snip/snippets/ — track with git, diff, merge, sync across machines
Fully offlineNo server, no account, your data stays local

Keyboard shortcuts

KeyAction
nNew snippet
eEdit selected snippet
dDelete selected snippet
yCopy content to clipboard
pToggle pin
/Focus search bar
EscClear search / return to list
or j kNavigate list
qQuit

Project structure

snip/
├── assets/
│   └── hero.svg
├── snip/
│   ├── __main__.py          # entry point + CLI
│   ├── app.py               # Textual app + demo seeding
│   ├── themes.py            # theme system — built-ins, JSON loading, CSS injection
│   ├── snip.tcss            # all styling (CSS variables, theme-agnostic)
│   ├── models/
│   │   └── snippet.py       # Snippet dataclass
│   ├── storage/
│   │   └── database.py      # flat-file store + SQLite index
│   ├── ui/
│   │   ├── screens/
│   │   │   ├── main_screen.py
│   │   │   └── edit_screen.py
│   │   └── widgets/
│   │       ├── app_header.py
│   │       ├── snippet_list.py
│   │       └── snippet_preview.py
│   └── utils/
│       └── clipboard.py
├── tests/
├── install.sh               # Linux / macOS installer
├── Makefile
└── pyproject.toml

Development

make dev        # create .venv + install with dev extras
make test       # run test suite
make test-cov   # run with coverage report
make run        # launch the app
make clean      # remove build artefacts and .venv

Docs

Full documentation is available on the wiki.


Neovim plugin

There's an unofficial Neovim plugin for snip: phlx0/snip.nvim

Note: The plugin is still in very early stages and may be a bit buggy. Feedback and issues are welcome.


Contributing

Bug reports and pull requests are welcome on GitHub.

  1. Fork the repo and create a branch: git checkout -b fix/my-fix
  2. Make your changes and add tests if relevant
  3. Run make test to make sure everything passes
  4. Open a pull request

License

MIT — see LICENSE.

SEE ALSO

clihub4/15/2026SNIP(1)