Technology Apr 18, 2026 · 3 min read

I built a terminal snippet manager that stores snippets as Markdown files you can git-track

You write a clever one-liner. You close the terminal. Three weeks later you're Googling the same thing again. That loop is what made me build snip a local, offline TUI snippet manager that lives entirely in your terminal. No browser, no account, no cloud dependency. https://github.com/phlx0/snip...

DE
DEV Community
by phlx0
I built a terminal snippet manager that stores snippets as Markdown files you can git-track

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

That loop is what made me build snip a local, offline TUI snippet manager that lives entirely in your terminal. No browser, no account, no cloud dependency.

https://github.com/phlx0/snip

How it works

snip is built on Python + Textual. The UI gives you a searchable list on the left, a syntax-highlighted preview on the right, and a modal form for creating or editing snippets.

Storage went through a significant architecture change in v0.7.0. Snippets are now stored as individual Markdown files with YAML frontmatter in ~/.config/snip/snippets/. A SQLite index (snip.db) sits alongside and is rebuilt from those files on startup it exists purely for fast querying and is excluded from git via an auto-created .gitignore.

This means your snippets directory is a plain folder of .md files you can track with git, push to a private repo, and sync across machines without any special tooling.

~/.config/snip/
  snippets/
    a1b2c3d4e5f6.md   # each snippet is its own file
    ...
  snip.db             # git-ignored index, rebuilt on startup
  config.json         # theme preference
  .gitignore

CLI first, TUI second

The TUI is the main interface, but snip is fully scriptable from the command line:

snip                          # open the TUI
snip "docker run"             # non-interactive lookup, prints + copies to clipboard
snip --exec "deploy script"   # run a snippet directly as a shell command
snip --list | fzf | xargs snip  # fzf integration
snip --add ./script.sh        # save a file as a snippet, language auto-detected
snip --export > backup.json   # dump all snippets to JSON
snip --import snippets.json   # bulk import
snip --from-history           # pick from shell history and save as snippet
snip --json "query"           # output full metadata as JSON for scripting
snip init zsh                 # print shell completion script

Theme system

As of v0.6.0, all UI colors are driven by a Theme dataclass and snip.tcss uses CSS variables throughout. Built-in themes are tokyo-night (default) and dracula.

Custom themes are plain JSON files stored in ~/.config/snip/themes/ shareable as Gists or committed to dotfiles. Syntax highlighting colors (via Pygments) and all Rich inline markup adapt to the active theme.

snip theme list
snip theme set dracula
snip theme import ~/my-theme.json
snip --theme dracula   # one-session override

Install

# One-liner (Linux / macOS)

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

The installer creates an isolated virtualenv at ~/.local/share/snip, drops a launcher at ~/.local/bin/snip, and patches your shell config if needed.

What's next

I'm thinking about import/export compatibility with other snippet tools (Raycast, VS Code snippets) and potentially a watch mode that syncs changes from the filesystem back into the index in real time.

Feedback welcome — especially if you use a snippet manager already and have opinions on what's missing.

Source: https://github.com/phlx0/snip

DE
Source

This article was originally published by DEV Community and written by phlx0.

Read original article on DEV Community
Back to Discover

Reading List