🌐 Website · 🚀 Product Demo · 📦 npm · 📖 Docs
A lightweight, cross-platform CLI for saving, searching, sharing, and running reusable code and shell snippets. Built for developers who live in the terminal.
Stop hunting through your shell history for that one command. snip is your terminal's memory — save, search, and execute code snippets in milliseconds.
- ⚡ Lightning Fast — Add, search, and run snippets in milliseconds
- 🔍 Fuzzy Search — Find anything instantly across names, tags, and content
- 🛡️ Safety First — Preview commands before execution, auto-detect dangerous operations
- 🎨 Interactive TUI — Keyboard-first terminal UI with syntax highlighting, line numbers, and split-pane
- 💾 Flexible Storage — JSON for simplicity, SQLite for scale
- 🔄 Gist Sync — Backup and share via GitHub Gists
- 🔗 fzf Integration — Pipe snippets through fzf with live preview
- 🚀 Zero-friction exec —
snip execruns immediately, no confirmation modal - 🩺 Health check —
snip doctorvalidates your setup in one command - 🏷️ Shell aliases —
eval "$(snip alias)"turns every snippet into a command
| Feature | snip | pet | navi | tldr | dotfiles / aliases |
|---|---|---|---|---|---|
| Run snippets directly | ✅ Any language | ✅ Shell only | ✅ Shell only | ❌ Reference only | ✅ Shell only |
| Multi-language (JS, Python, Ruby…) | ✅ | ❌ | ❌ | ❌ | ❌ |
| Interactive TUI | ✅ Split-pane | ❌ | ✅ Basic | ❌ | ❌ |
| Dangerous command detection | ✅ Auto-detect | ❌ | ❌ | ❌ | ❌ |
| fzf integration | ✅ Native | ✅ | ✅ Core | ❌ | Manual |
| SQLite backend | ✅ Optional | ❌ | ❌ | ❌ | ❌ |
| Gist sync | ✅ Push/pull | ✅ | ❌ | ❌ | Manual |
| Cross-platform | ✅ Node.js | Go binary | Rust binary | Multi | Varies |
| Zero config | ✅ Works out of box | ✅ | Needs cheats | ✅ | Heavy setup |
TL;DR: Other tools are great for shell commands. snip is for developers who save code — deploy scripts, API calls, Docker commands, JS utilities — across any language, with safety rails and a real TUI.
# Install globally
npm install -g snip-manager
# Add a snippet from stdin
echo 'docker run --rm -it -v "$PWD":/work -w /work ubuntu:24.04 bash' | snip add docker-run --lang sh --tags docker,run
# Or add from your editor (opens $EDITOR)
snip add my-script --lang bash --tags deploy,production
# Search snippets
snip search docker
# Run a snippet
snip run docker-run
# Launch interactive TUI
snip ui- Node.js 18+
- npm or yarn
npm install -g snip-manageryarn global add snip-managersnip --version| Command | Description |
|---|---|
snip add <name> --lang <lang> --tags <tag1,tag2> |
Save a new snippet from stdin or editor |
snip ui |
Launch interactive TUI with fuzzy search |
snip list [--json] |
List all saved snippets (JSON for scripting) |
snip search <query> [--json] |
Fuzzy search across all snippets |
snip run <id|name> |
Execute a snippet safely (with template prompts) |
snip exec <id|name> [--dry-run] [--force] |
Run immediately — no preview modal |
snip show <id|name> [--json] [--raw] |
Show snippet content |
snip edit <id|name> |
Edit snippet content in $EDITOR |
snip update <id|name> --tags <t> --lang <l> |
Update snippet tags or language |
snip cp <source> <dest> |
Duplicate a snippet |
snip mv <source> <newName> |
Rename a snippet |
snip cat <id|name> |
Print raw content to stdout (for piping) |
snip delete <id|name> |
Remove a snippet (alias: snip rm) |
snip recent [count] |
Show recently used snippets |
snip fzf |
Search snippets via fzf with live preview |
snip grab <url> |
Import a snippet from a URL or github:user/repo/path |
snip alias [shell] |
Generate shell aliases for all snippets |
snip doctor |
Health check — verify storage, editor, fzf, gist |
snip stats |
Show snippet library statistics |
snip widget [shell] |
Output Ctrl+G shell widget for zsh/bash/fish |
snip sync push [query] |
Upload matching snippets to GitHub Gist |
snip sync pull <gist-id> |
Download snippets from GitHub Gist |
snip config |
View or modify configuration |
snip --version |
Show version information |
snip --help |
Display help information |
snip config set editor "vim"Supported editors: vim, nvim, nano, code, subl
For larger snippet libraries (100+ snippets):
snip config set useSqlite trueRequires better-sqlite3 for native performance, or falls back to sql.js (WebAssembly).
| Option | Default | Description |
|---|---|---|
editor |
$EDITOR or vi |
Default editor for snippet creation |
useSqlite |
false |
Use SQLite instead of JSON storage |
snippetDir |
~/.snip |
Custom snippets directory |
Launch snip ui for a rich, split-pane interface:
- Navigation:
j/kor arrow keys to move up/down - Search:
/to search — list filters live as you type - Preview: Syntax highlighting and line numbers
- Add: Press
ato create a new snippet - Edit: Press
eto edit selected snippet - Run: Press
rto execute (shows preview first) - Delete: Press
d— type snippet name to confirm, thenzto undo within 5s - Sort: Press
sto cycle sort mode (persists across sessions) - Quit:
qorCtrl+C
Skip the preview modal when you know what you're running:
# Run immediately
snip exec deploy-api
# Dry run — just print the content
snip exec deploy-api --dry-run
# Skip dangerous-command warning
snip exec deploy-api --forceTurn every snippet into a native shell command:
# Generate aliases for bash/zsh
eval "$(snip alias)"
# Now every snippet is a command:
deploy-api # → snip exec deploy-api
docker-cleanup # → snip exec docker-cleanupsnip doctor
✓ Storage: JSON (42 snippets)
✓ Editor: code --wait
✓ Shell: /bin/zsh
✓ fzf: installed
✗ Gist sync: not configured# Raw content for piping
snip cat deploy | sh
snip show deploy --raw | clipboard
# JSON for scripting
snip show deploy --json | jq .tags
snip search docker --json | jq '.[].name'
snip list --json | jq lengthsnip cp deploy deploy-staging # Duplicate
snip mv old-name new-name # Rename
snip recent # Last 5 used
snip recent 10 # Last 10 usedsnip automatically detects potentially dangerous commands:
rm -rfand similar recursive deletionssudocommands- Network-intensive operations
- Commands that could modify system state
Preview is shown before execution — you confirm before running.
Use {{variable}} and {{variable:default}} syntax for reusable templates:
# Save a parameterized snippet
echo 'docker run --rm -it -v "{{dir:$PWD}}":/work {{image:ubuntu:24.04}} {{cmd:bash}}' \
| snip add docker-dev --lang sh --tags docker
# Run it — snip prompts for each variable
snip run docker-dev
# dir [/Users/me/project]: _
# image [ubuntu:24.04]: node:20
# cmd [bash]: shVariables support environment variable defaults with {{name:$ENV_VAR}}.
Import snippets directly from any URL:
# Grab from a raw URL
snip grab https://gist.githubusercontent.com/.../deploy.sh --tags deploy
# Shorthand for GitHub files
snip grab github:user/repo/scripts/backup.shLanguage is auto-detected from file extension and shebang.
Bind snip to a hotkey — search and paste snippets inline without leaving your prompt:
# Zsh — add to ~/.zshrc
eval "$(snip widget zsh)"
# Bash — add to ~/.bashrc
eval "$(snip widget bash)"
# Fish — add to ~/.config/fish/config.fish
snip widget fish | source
# Now press Ctrl+G anywhere to search and insert a snippetBackup and share your snippet library:
# Push all snippets to a new Gist
snip sync push
# Push matching snippets
snip sync push docker
# Pull from existing Gist
snip sync pull <gist-id>Tab completions ship with snip for bash, zsh, and fish:
# Bash — add to ~/.bashrc
eval "$(snip completion bash)"
# Zsh — add to ~/.zshrc
eval "$(snip completion zsh)"
# Fish — add to ~/.config/fish/config.fish
snip completion fish | sourceIf you have fzf installed, use snip fzf for a searchable list with a live preview pane:
# Search and preview snippets
snip fzf
# Pipe selected snippet to clipboard
snip fzf | pbcopy
# Bind to a shell shortcut (add to ~/.zshrc)
bindkey -s '^S' 'snip fzf\n'Ensure npm global bin directory is in your PATH:
# Add to ~/.zshrc or ~/.bashrc
export PATH="$(npm global bin):$PATH"Set your preferred editor:
snip config set editor "vim"Fix npm permissions:
# Option 1: Use nvm
nvm install --lts
npm install -g snip-manager
# Option 2: Use sudo (not recommended)
sudo npm install -g snip-managersnip is a CLI tool that helps developers manage and reuse code snippets directly from the terminal. Think of it as a personal library for your most-used commands and code blocks.
dotfiles store configuration files, while snip focuses specifically on executable snippets — commands and code blocks you run repeatedly. snip provides instant search and one-command execution.
Yes! Use --lang to specify the language:
snip add deploy --lang python --tags deployYes, via GitHub Gist sync:
# Export to Gist
snip sync push
# Import from Gist
snip sync pull <gist-id>Local snippets are stored in ~/.snip/ by default. Gist sync requires GitHub authentication. All data stays on your machine unless you explicitly choose to sync.
Contributions are welcome! Please read our Contributing Guide first.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
See SECURITY.md for our security policy and reporting guidelines.
MIT License — see the LICENSE file for details.
Built for developers who live in the terminal. ⚡