Absortio

Email → Summary → Bookmark → Email

# Text Files > Complex Tools: A Minimalist Snippet Manager

Extracto

I built a lightweight command-line tool that lets you quickly browse a directory of plain text snippets, select one using fuzzy search, and instantly copy its contents to your clipboard.

Contenido

Back to overview

I built a lightweight command-line tool that lets you quickly browse a directory of plain text snippets, select one using fuzzy search, and instantly copy its contents to your clipboard.

Before

I used to rely on a Firefox snippet manager for email replies and various IDE-specific tools for code snippets. The downside? Exporting and sharing those snippets across different applications was cumbersome, all I really needed was something simple and flexible.

The snippets repository

So, I created a dedicated snippets directory with a straightforward folder structure to keep everything organized:

snippets/
├── mail/
│   ├── work/
│   └── private/
├── c/
├── swift/
├── bash/
└── ...

Each snippet is stored as a plain text file within its relevant category. For example, I have a recurring monthly email for timesheets:

File: snippets/mail/work/monthly_timesheet.txt

Contents:

Hi,

In attachment you can find the timesheet
and corresponding invoice for the past month.

Regards,

Why text files?

The real beauty of this approach is its simplicity: I can use any text editor to create, edit, or store a snippet—no special software required. There’s no proprietary format, just plain text in its most basic form. This means my snippets will work on any device, old or new, without worrying about compatibility issues or being locked into a subscription for some &quotSnippets Plus Manager&quot upgrade.

Best of all, I don’t have to fear that the app I rely on will disappear in a few years, leaving my aging devices stranded. It’s future-proof, lightweight, and entirely under my control.

Here&#39s another similar blog post I came across a while ago:

How I fell in love with calendar.txt (by Ploum)

The script to select and copy the snippet

I wrote a short bash script that uses fzf for fuzzy matching. (= typing something that approximately matches what you are looking for)

With just a few keystrokes, I can search for a snippet by name, and the script copies its contents directly to my clipboard—ready to paste wherever I need it.

#!/bin/bash

copy_to_clipboard() {
    local file=&quot$1&quot
    if [[ -f &quot$file&quot ]]; then
        cat &quot$file&quot | xclip -selection clipboard
        echo &quotContents of &#39$file&#39 copied to clipboard.&quot
	cat &quot$file&quot
    else
        echo &quotError: File &#39$file&#39 not found.&quot
    fi
}

cd &quot$(dirname &quot${BASH_SOURCE[0]}&quot)/snippets&quot || exit 1
selected_file=$(fzf --prompt=&quotSelect a snippet: &quot)
if [[ -z &quot$selected_file&quot ]]; then
    echo &quotNo snippet selected. Exiting.&quot
    exit 0
fi

copy_to_clipboard &quot$selected_file&quot

(This script uses xclip to write to the clipboard on linux, if you are running macos, you can use pbcopy instead)

Tags

Development, HomeLab

You can get in touch through Mastodon:

@rxpz@social.linux.pizza

Text Files &gt Complex Tools: A Minimalist Snippet Manager was published on 2025-09-13

Back to the overview 📰 Subscribe to RSS feed 📰