← Back to home

🚀 Full Product Demo

Welcome to the ultimate guide for snip. This document will walk you through everything from your first snippet to advanced shell integration.

1. Installation & Setup

Get snip running on your machine in seconds.

# Install globally
npm install -g snip-manager

# Set up the shell widget (for Ctrl+G magic)
eval "$(snip widget)"

2. Quick Setup with snip init

First time? Run the guided setup wizard to get started in under 60 seconds:

snip init

The wizard will:

  1. Set your preferred editor (vim, code, nano, etc.)
  2. Install the Ctrl+G shell widget for your shell
  3. Seed 10 example snippets to get you started
  4. Optionally launch the TUI for a quick tour

3. Core Workflow: Capture, Find, Run

📥 Capture: Saving snippets

# Interactive add (opens $EDITOR)
snip add my_script --lang js --tags node,util

# Pipe directly
echo "curl -X POST http://api.local/dev" | snip add quick_post

# Language shortcuts — add:js, add:py, add:sh
snip add:js myscript        # same as: snip add myscript --lang js
snip add:py myfunc          # same as: snip add myfunc --lang python
snip add:sh mycmd           # same as: snip add mycmd --lang bash

🔍 Find: Listing your collection

# List all snippets
snip list

# Filter by tag or sort by most used
snip list --tag node --sort usage

🏃 Run: Instant execution

snip run quick_post

4. Advanced Features

🎚️ Parameters (Templates)

Use {{name}} or {{name:default}} in your snippets. snip will interactively prompt you for values when running.

docker run --rm -it {{image:ubuntu:24.04}} {{cmd:bash}}

🔗 Grab: Import from the Web

snip grab github:user/repo/scripts/backup.sh --name backup

🤖 AI: Generate Snippets

Generate snippets using AI (requires an OpenAI API key):

# Set your API key
export SNIP_AI_API_KEY="your-openai-api-key"

# Generate a Docker health check
snip ai generate "docker container health check"

# Generate a Python web server
snip ai generate "simple flask server" --lang python --tags web,api

# Generate with custom name and model
snip ai generate "curl wrapper with retry" --name curl-retry --model gpt-4

⚡ Smart Search (fzf)

snip fzf

⚡ Zero-Friction Exec

Skip the preview modal when you know what you're running:

# Run immediately
snip exec deploy-api

# Dry run — just print what would execute
snip exec deploy-api --dry-run

# Skip dangerous-command warning
snip exec deploy-api --force

🏷️ Shell Aliases

Turn 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-cleanup

🩺 Health Check

Verify your setup in one command:

snip doctor
  ✓ Storage: JSON (42 snippets)
  ✓ Editor: code --wait
  ✓ Shell: /bin/zsh
  ✓ fzf: installed
  ✗ Gist sync: not configured

5. UI/UX & Safety

⚠ Safety First

snip automatically detects dangerous commands like rm -rf. If a snippet is risky, it will demand an explicit "yes" confirmation.

🎨 Beautiful Terminal UI

Launch a full-screen interactive view of your library with snip ui. Features syntax highlighting, line numbers, incremental search, and undo delete.

⌨️ Shell Widget (Ctrl+G)

Press Ctrl+G anytime in your terminal to fuzzy-search and insert snippets directly into your prompt.

6. Snippet Management

# Duplicate a snippet
snip cp deploy deploy-staging

# Rename a snippet
snip mv old-name new-name

# Print raw content for piping
snip cat deploy | sh

# Show recently used snippets
snip recent
snip recent 10

7. Pipe-Friendly Output

# JSON output for scripting
snip show deploy --json | jq .tags
snip search docker --json | jq '.[].name'
snip list --json | jq length

# Raw output (no headers)
snip show deploy --raw | pbcopy

8. Maintenance

Command Description
snip config View and edit settings
snip export Backup library to JSON
snip show --edit Quickly edit an existing snippet
snip stats See your productivity data
snip doctor Verify your setup — storage, editor, fzf, gist
snip cp / mv Duplicate or rename snippets
snip alias Generate shell aliases for every snippet
Pro Tip: SQLite

For large libraries, enable SQLite in your config for blazing-fast performance:

snip config set useSqlite true