A fast, Vim-inspired terminal email client for Maildir folders, written in Rust. Heavily inspired by aerc.
cargo install --path .- Threaded email list with tree connectors, reply counts and adaptive columns
- Diff/patch syntax highlighting and nested quote coloring in email bodies
- Underlined, clickable links (OSC 8 hyperlinks, also when a URL wraps)
- Reply, reply-all with quoting, forward, built-in Vim-style compose editor
- Drafts and Trash mailboxes (auto-created if not configured)
- Read/unread tracking, flagging, live search, unread-only filter
- Multiple mailboxes with sidebar, tab-based email viewing
- Optional preview pane below the thread list
- Move emails or entire threads between mailboxes, with a filterable target list
- Short confirmation toasts for moves, deletes, sends and drafts
- SMTP sending via STARTTLS in the background (a failed send reopens the draft)
- Periodic background sync via a configurable shell command (e.g.
mbsync) - Quick reply templates bound to number keys (
1-9,0) - GPG decryption and signature verification (PGP/MIME and inline PGP)
- List received attachments and save them to disk
- Send file attachments with filesystem path completion
- Optional Nerd Font icons
- Optional mouse support: click tabs, mailboxes and emails, scroll with the wheel
Run kingi init [account] to initialize ~/.config/kingi/, or create
~/.config/kingi/accounts/<account>/config.toml for each account:
[smtp]
host = "smtp.gmail.com"
port = 587
name = "Name Surname"
username = "you@example.com"
password = "app-password"
[[mailbox]]
label = "INBOX"
path = "/home/you/Mail/INBOX/"
markers = true # Enables patch status tracking (merged, reviewed, superseded)
notifications = true # Enables desktop notifications on new mail
# "Drafts" and "Trash" labels are treated specially.
# If omitted, defaults are created in the account directory.
[[mailbox]]
label = "Drafts"
path = "/home/you/Mail/Drafts/"
[[mailbox]]
label = "Trash"
path = "/home/you/Mail/Trash/"Global settings go in ~/.config/kingi/config.toml:
# Optional: run a shell command every N seconds to sync mail.
# timeout defaults to 60 seconds if omitted.
[sync]
command = "mbsync -a"
interval = 60
timeout = 60
# Optional: Case-insensitive regular expressions that mark a patch as merged.
# If omitted, kingi uses the default lore-cli regexes.
[status]
merged_markers = [
# Line begins with the action verb, followed by "thanks", a target tree
# ("to <tree>"), or end-of-statement — e.g. "Applied, thanks",
# "Merged.", "Pushed to for-next".
"\\b(applied|merged|pushed)(,?\\s+thanks|\\s+to\\s+\\S+|[.!]|\\s*$)",
# "thanks, applied" / "thanks merged".
"\\bthanks,?\\s+(applied|merged|pushed)\\b",
# "patchset applied", "series merged" as a line-leading statement.
"\\b(patch(set|es)?|series)\\s+(applied|merged)(,?\\s+thanks|\\s+to\\s+\\S+|[.!]?\\s*$)",
# "Thanks ... merged" / "Thanks ... pushed"
"\\b(T|t)hanks.*(merged|applied|pushed)",
]A plain-text ~/.config/kingi/accounts/<account>/signature file, if present,
is appended to every draft.
Press p in the thread list to show the selected email below the list.
Tab moves the focus (highlighted pane title) between the list and the
preview; while the preview has focus, j/k, Ctrl+D/Ctrl+U and
g/G scroll it.
The preview never runs GPG (encrypted emails show a placeholder until
opened with Enter) and does not mark emails as read. To show it at
startup, add to the global config.toml:
[ui]
preview = trueThe UI uses plain Unicode symbols that work with any font. If your
terminal uses a Nerd Font (preferably a
"Mono" variant, so glyphs stay one column wide), switch to its icons in
the global config.toml:
[ui]
nerd_fonts = trueLinks in email bodies are underlined and emitted as OSC 8 hyperlinks, so
they can be opened with a click (often Ctrl+click) even when wrapped.
Terminals without OSC 8 support should show plain text; if yours prints
stray characters instead, disable them in the global config.toml:
[ui]
hyperlinks = falseMouse support is off by default, because capturing the mouse disables the
terminal's own text selection (most terminals still select with
Shift+drag). To enable it, add to the global config.toml:
[ui]
mouse = trueClicking a tab or mailbox switches to it, clicking an email selects it and clicking the selected email opens it. The wheel moves the selection in the thread list, switches mailboxes over the sidebar and scrolls email bodies.
Place template files named reply-1 through reply-9 and reply-0 in the
config directory (~/.config/kingi/). Pressing the corresponding number key
on an email opens a reply pre-filled with that template's content.
For example, create ~/.config/kingi/reply-1:
Thanks for the patch, applied!
Then press 1 on any email to reply with that text.
Kingi automatically detects and decrypts PGP-encrypted emails and verifies
PGP-signed emails when opened. Both PGP/MIME (RFC 3156) and inline PGP
formats are supported. Encrypted emails are marked with a ⚷ icon (a lock
with Nerd Font icons) in the thread list.
A working gpg-agent is required for passphrase handling. To override the
GPG binary path:
[gpg]
binary = "gpg2"Kingi supports sending and receiving file attachments. Attachment lists show filenames and sizes. Received files can be saved to disk without overwriting existing files, including attachments in PGP/MIME emails after decryption.
The compose editor supports adding and removing files, with filesystem path completion for relative, absolute, and home-directory paths. Attached files retain their contents even if the original files change. Saved drafts preserve attachments, and send or save errors keep the message available for retry.
| Key | Action |
|---|---|
r / R |
Reply-all / reply-all quoted |
1-9, 0 |
Quick reply with template |
f |
Forward |
C |
Compose new email |
/ / Esc |
Search by subject / clear |
\ / Esc |
Search by sender / clear |
m / M |
Move email / move entire thread |
D |
Delete email |
Enter |
Open email (in Drafts: reopen in editor) |
p |
Toggle preview pane |
Tab |
Focus thread list / preview |
Ctrl+E/Ctrl+Y |
Scroll preview down / up |
v |
Toggle read / unread |
Ctrl+f |
Toggle flagged |
Ctrl+x |
Toggle merged |
Ctrl+A |
Mark all emails as read |
j/k/↑/↓ |
Move selection |
Ctrl+D/Ctrl+U |
Page down / up |
g / G |
First / last email |
J / K |
Next / previous mailbox |
s |
Toggle sort order |
V |
Toggle unread-only filter |
F |
Toggle flagged-only filter |
Ctrl+S |
Force sync |
? |
Help |
Q |
Quit (Q twice with unsaved drafts) |
With unsaved compose tabs open, Q asks for a second Q before quitting.
If messages are still being sent, kingi quits once they finish; any other
key cancels the pending quit.
| Key | Action |
|---|---|
r / R |
Reply / reply quoted |
1-9, 0 |
Quick reply with template |
f |
Forward |
Y |
Copy body to clipboard |
a |
List / save attachments |
m / M |
Move email / move thread |
Ctrl+f |
Toggle flagged |
Ctrl+x |
Toggle merged |
D |
Delete and close tab |
j/k/↑/↓ |
Scroll line |
Ctrl+D/Ctrl+U |
Page down / up |
g / G |
Top / bottom |
J / K |
Next / previous email |
? |
Help |
q |
Close tab |
| Key | Action |
|---|---|
Ctrl+Q |
Send dialog |
Ctrl+A |
Manage attachments |
j/k |
Navigate dialog options |
Enter |
Confirm (Send / Save draft / Discard) |
Esc |
Back to editor |
| Key | Action |
|---|---|
j/k/↑/↓ |
Select mailbox (↑/↓ while filtering) |
/ |
Filter mailboxes by name |
Enter |
Move |
Esc |
Clear filter / close |
| Key | Action |
|---|---|
Ctrl+N / Ctrl+P |
Next / previous tab |
This project started with the aim of learning more about the Rust
programming language. Over the 2025 Christmas holidays, I set myself a
challenge: design an algorithm to load n emails from a Maildir and
reconstruct their threads in O(n) time. Each thread forms a tree, with
emails as nodes and replies linked to their parent messages.
That challenge led to learning Rust's shared memory management, fighting with the borrow checker, and achieving C-like performance. It was a lot of fun, even if the borrow-checker struggle is very real.
Around March–April 2026, the emergence of more capable LLMs, such as Opus 4.6, made it possible to speed up development and tackle a task I hadn't been able to finish due to work and personal commitments: writing a proper UI around that algorithm.
It worked, but with a caveat: LLMs produced tons of bad code. I had to
work through that, learning how to use these new tools effectively while
adding all the features I had always wanted in a terminal email client:
keybindings similar to aerc, fast loading speeds, and a workflow
tailored for mailing-list patch reviews (LTP and the Linux kernel in
particular).
In the end, it worked out. kingi became my primary terminal email
client: fast, easy to use, shaped around my workflow, and with unique
features no other client offered. This is the best email client I have ever
used, and I want to share it with everyone who is willing to try it out.
