Skip to content

Repository files navigation

snipit 📎

A snappy personal code snippet manager for your terminal.
Save, search, and copy snippets without leaving your workflow.

Node.js 18+ Node.js 18+ License

InstallQuick StartCommandsData


Why snipit?

You know that one-liner you Google every time? The tsconfig you copy from an old project? The regex you always lose?

snipit stores them locally, tagged and searchable, ready to copy to your clipboard in one command. No account, no sync, no internet — just a JSON file on your machine.


Install

npm i -g @fouaden/snipit

Requirements: Node.js 18+


Note!

macOS/Linux: If you get an EACCES permission error, run

 sudo npm install -g @fouaden/snipit # This happens when npm's global folder is owned by root.

Quick Start

# save a snippet
snipit save "kill port 3000" --code "lsof -ti:3000 | xargs kill" --tag node

# find it
snipit list --tag node

# grab it
snipit get "kill port 3000" --copy

Commands

Save a snippet

# inline code
snipit save "kill port 3000" --code "lsof -ti:3000 | xargs kill" --tag node

# from a file — reads the file content and stores it
snipit save "tsconfig base" --file ./tsconfig.json --tag ts

# multiline — opens your default editor
snipit save "async fetch" --tag js

Tags are comma-separated and optional:

snipit save "docker prune" --code "docker system prune -af" --tag "docker,ops"

List snippets

snipit list                    # all snippets
snipit list --tag ts           # filter by tag
snipit list --search "docker"  # search by title

Get a snippet

snipit get "kill port 3000"          # prints to terminal
snipit get "kill port 3000" --copy   # prints + copies to clipboard

Since output goes to stdout, you can pipe it too:

snipit get "tsconfig base" > tsconfig.json
snipit get "nginx config" | ssh user@server "cat > /etc/nginx/nginx.conf"

Delete a snippet

snipit delete 3   # use the ID shown in snipit list

Import and Export snippets

snipit import -f ./new-snippets.json

snipit export -o ./my-snippets.json

Data

Snippets are stored at ~/.snipit/snippets.json as a plain JSON file. No database, no server, no account.

{
  "snippets": [
    {
      "id": 1,
      "title": "kill port 3000",
      "code": "lsof -ti:3000 | xargs kill",
      "tags": ["node"],
      "created": "2026-02-25"
    }
  ],
  "lastId": 1
}

You can back it up, sync it with Dropbox, or commit it to a private repo — it's just a file.


License

MIT

About

A lightweight CLI tool to save, search and tag code snippets locally. Stop re-typing; start snipping.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages