medi ✒️
medi, a speedy CLI driven Markdown manager
A fast, editor-centric, command-line notes manager.
medi is a simple and powerful tool for creating and managing your notes, articles, and documentation directly from the terminal. It's built for developers, writers, and anyone who loves the speed and focus of a command-line workflow.
Core Philosophy
medi is built on a few guiding principles:
- CLI-first: Everything is done through the terminal. No GUIs or TUIs, no distractions.
- Editor-centric: Your text editor (
$EDITOR) is where you write.medigets you there quickly and saves your work securely. - Local & private: All content is stored on your local machine in a high-performance embedded database. No cloud services, no network access.
- Zero-config start: Install it and start writing immediately.
Features ✨
- Speed: Instant access to any note, no matter how large your collection grows, thanks to an embedded database index.
- Focused Workflow: A command-line hub for your writing. Create or edit notes from any directory without needing to
cdfirst. - Flexible Input: Create notes in the way that suits your workflow:
- Interactively in your favorite editor for long-form content.
- Instantly with a one-liner using the
-mflag for quick thoughts. - Powerfully by piping from other commands for scripting.
- Safe Deletion: An interactive confirmation prompt on
deleteprevents you from accidentally losing work. - Colorful & Clear Output: Uses colored output to clearly distinguish between success messages, information, warnings, and errors.
How It Works, DB as Source-of-Truth
medi uses a database-first approach. All your notes are stored in a sled key-value database, making access fast and reliable. This database is the single source of truth.
To version control your work with Git, medi provides a simple and deliberate workflow:
- Write: Use
medi newandmedi editto manage your notes. - Export: Run
medi export ./my-notesto write all your notes to a local directory as.mdfiles. - Commit: Use Git to commit the exported directory, giving you a complete, version-controlled snapshot of your work.
⚠️ Breaking Change (for versions >= 0.6.0)
The default database location has been updated to follow standard conventions for each operating system. If you are updating from an older version of medi, you must manually move your database to the new location to keep your existing notes.
To migrate your data:
- Find your old database folder at
~/.medi/medi_db. - Move it to the new standard location for your OS:
- macOS: Move it to
~/Library/Application Support/medi/ - Linux: Move it to
~/.local/share/medi/ - Windows: Move it to
%APPDATA%\medi\(usuallyC:\Users\<user>\AppData\Roaming\medi\)
- macOS: Move it to
This one-time move will ensure medi is a good citizen on your filesystem. New installations will automatically use the correct path.
Installation
You need Rust and Cargo installed.
Installing from crates.io
The easiest way to install medi is to download it from crates.io. You can do it using the following command:
If you want to update medi to the latest version, execute the following command:
Building from source
Alternatively you can build medi from source using Cargo:
Configuration
On the first run, medi will automatically create a default configuration file at the standard location for your operating system:
- macOS:
~/Library/Application Support/medi/config.toml - Linux:
~/.config/medi/config.toml - Windows:
C:\Users\<user>\AppData\Roaming\medi\config.toml
You can edit this file to customize medi's behaviour.
Example config.toml
# Path to the database file.
# You can change this to store your notes in a different location,
# for example, inside a cloud-synced folder like Dropbox.
= "/Users/cladam/Library/Application Support/medi/medi_db"
# Default directory for the `medi export` command.
# If this is set, you can run `medi export` without specifying a path.
# Leave it as an empty string ("") if you don't want a default.
= "/Users/cladam/Documents/medi_backups"
Usage
Creating and Editing Notes
-
Create a new note
mediprovides three ways to create a new note:-
Interactively (default): Opens your default editor for long-form content.
# With tags: Add tags to your note for better organisation. # With a title: Specify a title for your note. -
With a direct message: Perfect for quick, one-line notes.
-
From a pipe: Use the output of other commands as your note content.
|
-
-
Edit an existing note
# Add tags to a note # Remove tags from a note
Viewing and listing notes
-
Get a note's content Prints the note directly to the console. This is perfect for piping to other tools.
# Pipe to a Markdown renderer like mdcat | # Get a note in Json format # Get one or several notes via a tag
-
List all notes
The
listcommand provides a rich overview of your notes, including their keys and tags.Output:
Notes: - medi-readme [#medi #README] - tbdflow-readme [#tbdflow #README] - tbdflow-gif-post [#blog] -
Sort your notes
You can sort the list by creation or last modification date using the
--sort-byflag. The default is to sort alphabetically by key.# Sort by the most recently modified notes # Sort by when the notes were created
Deleting a Note
-
Delete a note You will be prompted for confirmation.
# Skip the confirmation prompt
Versioning with Export/Import
-
Export all notes to a directory Creates a version-controllable snapshot of your database.
-
Export all notes to a Json document
-
Export notes via a tag
-
Import notes from a directory Restores notes from a directory of .md files.
# By default, skips any notes that already exist # Import a single # Overwrite existing notes with the imported versions
Shell Completion
To make medi even faster to use, you can enable shell completion. Add one of the following lines to your shell's configuration file.
For Zsh (~/.zshrc):
For Bash (~/.bashrc):
For Fish (~/.config/fish/config.fish):
|
Project Roadmap 🗺️
This section tracks the implementation status of medi's features. Contributions are welcome!
- All core commands (new, get, list, edit, delete, import, export).
- Configuration file for settings (e.g., database path).
- Support for note metadata (tags, creation dates).
-
exportnotes by tag. - Full-text search over note content.
- Implement a
taskcommand for tracking the status of notes.