A simple, reliable clipboard-stash plugin for the Micro text editor.
Micro Stash gives you a persistent text snippet store on disk, so you can save frequently used fragments and paste them back whenever you need them.
It is designed for people who reuse the same code blocks, shell snippets, command templates, notes, boilerplate text, or any other text fragments over and over again.
Micro's built-in clipboard is great for normal copy/paste, but it is temporary and limited to the current workflow.
This plugin adds a small, persistent stash with the following idea:
- save text snippets to disk
- list them later
- paste them into the current buffer
- edit them in a separate working copy
- remove them when no longer needed
Each snippet is stored in your home cache directory:
$HOME/.cache/micro/stash-plugin/
The plugin keeps two copies for each snippet:
snippets/— the base snippet used byp>editing/— the editable working copy opened bye>
This split makes the workflow simple and predictable: you paste from the stable base copy, and you edit through the working copy.
Tip
Thanks to this plugin, you can create a convenient, customizable clipboard and quick templates for projects, scripts, etc.
- Save selected text as a reusable snippet
- Save the current line when no selection is present
- Paste snippets into the buffer
- Replace the current selection with a snippet
- Insert snippets at the cursor when nothing is selected
- Open snippets in an editable working copy
- Store snippets persistently on disk
- List all saved snippets with previews
- Remove snippets from storage
- Support snippet names with spaces
- Keep the base copy and editable copy in sync by content
- Minimal, command-based workflow
- Simple storage layout under the user cache directory
This plugin must be cloned into a directory named exactly stash.
Warning
If the plugin folder uses the original repository name (micro-stash-plugin), the commands may not work correctly.
Use this name:
stash
Clone the repository inside your Micro plugins directory.
Example:
git clone https://github.com/BuriXon-code/micro-stash-plugin.git stashThat means the directory name must be stash (my recommendation), not micro-stash-plugin.
Depending on your setup, Micro plugins are usually stored under:
$HOME/.config/micro/plug/
So a typical installation looks like this:
cd ~/.config/micro/plug
git clone https://github.com/BuriXon-code/micro-stash-plugin.git stashRestart Micro if it was already running.
Then the commands should be available in the command bar (CTRL+E)
Micro Stash is driven entirely by commands.
The plugin registers these commands:
| Option | Meaning | Description |
|---|---|---|
s> |
save/set | Saves the current selection as a new snippet. If nothing is selected, the current line is saved instead. |
p> |
paste/put | Inserts a saved snippet into the buffer. If text is selected, the selection is replaced. If nothing is selected, the snippet is inserted at the cursor position. |
e> |
edit | Opens the editable working copy of a snippet in a split buffer. |
r> |
remove | Deletes a snippet from both storage locations. |
l> |
list | Shows all saved snippets with previews and metadata. |
h> |
help | Opens the built-in help screen. |
You run them from Micro's command bar.
Commands take a snippet name as an argument when needed:
s> name
p> name
e> name
r> name
Snippet names may contain spaces:
s> my shell snippet
p> my shell snippet
e> my shell snippet
Use s> to save the current selection as a new snippet.
If nothing is selected, the current line is saved instead.
Examples:
s> greet
s> shell alias
s> api response template
What it does:
- takes selected text, or the current line if nothing is selected
- trims the saved text only for emptiness checks
- refuses to save an empty snippet
- refuses to overwrite an existing snippet
This means s> is meant for creating new snippets, not replacing old ones.
- Select a block of text in Micro.
- Run:
s> my block
- The snippet is saved on disk.
- Later, you can paste it back with:
p> my block
If your cursor is on a line like this:
export PATH="$HOME/bin:$PATH"
and nothing is selected, then:
s> path export
will save that entire line as a snippet.
Use p> to paste a saved snippet into the current buffer.
Examples:
p> greet
p> shell alias
p> api response template
What it does:
- loads the snippet from disk
- if text is selected, replaces the selection
- if nothing is selected, inserts at the cursor position
- refuses to paste a snippet that does not exist
Suppose you have this selected:
old text
and you run:
p> greet
the selection is replaced with the stored snippet contents.
If the cursor is placed in the middle of a line and nothing is selected, p> inserts the snippet there.
For example, if the line is:
echo Hello
and the cursor is after echo , then:
p> world
may produce:
echo World
depending on the snippet contents.
p> always uses the base copy from snippets/.
Before pasting, the plugin synchronizes the editable copy back to the base copy if the contents differ.
That means your latest edits are used, as long as the working copy has been saved.
Use e> to open the editable working copy of a snippet.
Examples:
e> greet
e> shell alias
e> api response template
What it does:
- opens the snippet's editable copy in a split
- if the base snippet exists, the editable copy is refreshed from it
- if the snippet does not exist yet, a new editable file is created
- lets you edit the snippet inside Micro
- saving the buffer updates the editable file on disk
If the snippet already exists, e> name opens a working copy stored in:
$HOME/.cache/micro/stash-plugin/editing/
You can modify it, save it in Micro, and the updated contents will be used the next time you paste with p>.
If the snippet does not exist yet, e> still opens an editable file for that name.
That lets you prepare a snippet before it has a base copy.
Once you save and later use p> name, the base snippet is created or updated through the normal sync flow.
- Run:
e> api response template
- Edit the snippet in the opened buffer.
- Save the file inside Micro.
- Later, paste it with:
p> api response template
This is the cleanest way to maintain reusable text blocks.
Use r> to delete a snippet from both storage locations.
Examples:
r> greet
r> shell alias
r> api response template
What it does:
- removes the base snippet from
snippets/ - removes the editable copy from
editing/ - clears the snippet from both places
Use it when a snippet is no longer needed.
Use l> to display the saved snippets list.
Example:
l>
The list shows:
- snippet names
- whether the editable copy differs from the base copy
- line count
- byte count
- a short preview of each snippet
If no snippets exist yet, the list will say so.
After saving a few snippets:
s> greet
s> shell alias
s> api response template
run:
l>
You will see a list of all saved snippets, with a preview of each one.
The list buffer is informational only.
It is not meant to be edited as a snippet source.
Use h> to open the built-in help screen.
Example:
h>
This displays a short guide inside Micro with a summary of the plugin commands and behavior.
This plugin uses a very straightforward model:
- Save text as a snippet with
s> - Edit it later with
e> - Paste it with
p> - Remove it with
r> - Inspect everything with
l>
The storage layout is intentionally simple:
$HOME/.cache/micro/stash-plugin/
├── snippets/
│ └── name.txt
└── editing/
└── name.txt
- The base copy is the canonical snippet content used for pasting.
- The editable copy is the working file you open with
e>.
This separation keeps daily use predictable: you can tinker with the editable version without losing the stable base immediately.
When the plugin detects that the editable copy differs from the base copy, it synchronizes the base copy from the editable copy.
This means:
- edit the snippet
- save the file in Micro
- paste later
- get the updated content
That behavior is useful when you want the editable file to act like a draft area before becoming the active snippet.
This plugin is intended for Micro Editor on Unix-like systems such as:
- Linux
- macOS
- Termux on Android (my main setup)
- The plugin relies on standard shell and filesystem behavior.
- It uses
mkdir -pandfindinternally. - It expects the usual Micro plugin environment with command registration.
- Some Micro builds may differ in split-buffer support, which can affect how the plugin opens help, list, and edit buffers.
The repository must be given a different name when downloading. It doesn't work with the original directory name.
This project is licensed under the MIT License.
See the LICENSE file for the full text.
For any issues, suggestions, or questions, reach out via:
- Email: support@burixon.dev
- Contact form: Click here
- Bug reports: Click here
If you find this script useful, consider supporting my work by making a donation:
Your contributions help in developing new projects and improving existing tools!