mustty documentation
mustty is a terminal Markdown editor for writing one file at a time on a centred column. This page covers installation, keys, settings and behaviour in the terminal app and the browser demo.
Install and open a file
Install mustty and open a document in under a minute.
# macOS and Linux
curl -LsSf https://github.com/joyqi/mustty/releases/latest/download/mustty-installer.sh | sh
# Homebrew
brew install joyqi/tap/mustty
# From source (Rust 1.88+)
cargo install --git https://github.com/joyqi/mustty
# Windows (PowerShell)
irm https://github.com/joyqi/mustty/releases/latest/download/mustty-installer.ps1 | iex
Prebuilt archives are also on the GitHub repository under Releases.
Run mustty [FILE]. The only flags are -h / --help and -V / --version. Passing a path such as mustty notes.md opens the file or creates it on first save. Running mustty alone opens an Untitled document. Passing a directory fails with mustty only edits files. mustty edits one file per run and has no command to open another.
The screen has three parts: a title line, a body and a one-line status bar. The title is the file's first-line H1 (# text), edited as its own field; press ↑ on the first body line to enter it, and Enter or Tab to return to the body. The status bar shows the file name, a save mark (* unsaved, green ● saved), the word count and line:col (Title while in the title). For the first 5 seconds the right side shows ^G keys.
Press Ctrl+S to save and Ctrl+Q to quit. On a document with no file yet, Ctrl+S opens Save as: prefilled with a name relative to the working directory: the # heading without /, \, :, control characters and leading dots, cut to 80 characters, such as My Notes.md, or untitled.md when there is no heading; if that file exists, the next free one, such as My Notes-2.md. The name before .md is selected, so typing replaces it. Later saves keep the file name even when the heading changes. The prompt asks File exists, Enter to overwrite: if that file exists. When unsaved changes cannot be autosaved on quit, mustty shows Unsaved changes, press Ctrl+Q again to discard.
Default keys
Move and edit without modes; press Ctrl+G to view this list inside the app.
| Action | Key |
|---|---|
| Move cursor | ↑ ↓ ← → |
| Start / end of screen line | Home / End |
| Page up / down | PgUp / PgDn |
| Previous / next word | Ctrl+← / Ctrl+→, Alt+B / Alt+F |
| Start / end of document | Ctrl+Home / Ctrl+End |
| Select | Shift + any move key (such as Shift+→) |
| Select whole body (excludes title) | Ctrl+A |
| Clear selection / close save prompt | Esc |
| Indent / outdent list item | Tab / Shift+Tab |
| Check / uncheck a task (or make the line one) | Ctrl+D |
| Delete previous word | Ctrl+Backspace, Ctrl+W |
| Copy / cut / paste (internal register) | Ctrl+C / Ctrl+X / Ctrl+V |
| Undo / redo | Ctrl+Z / Ctrl+Y |
| Save / quit | Ctrl+S / Ctrl+Q |
| Find / next / previous match | Ctrl+F / Ctrl+N / Ctrl+B |
| Open the link under the cursor | Ctrl+L |
| Typewriter mode / focus mode | Ctrl+T / Ctrl+O |
| Settings panel / keys panel | Ctrl+P / Ctrl+G |
Home and End act on the wrapped screen line, not the logical line. Ctrl+C copies rather than quitting, Ctrl+Z undoes rather than suspending, and Ctrl+V pastes mustty's internal register rather than the system clipboard. Since 0.1.6, Ctrl+F opens find and Ctrl+O toggles focus mode. Outside a list item, Tab inserts tab_width spaces and Shift+Tab does nothing. In the keys panel, scroll with ↑, ↓, PgUp, PgDn, Home or End, and close with Esc or Ctrl+G.
Ctrl+L opens the link under the cursor in your browser: the (url) of a Markdown link when the cursor is anywhere on it, or a plain URL. Only http:// and https:// addresses open (www. gets https://). For anything else, or when the system has no opener (open, xdg-open), the status bar shows the address instead.
Lists continue as you write. On a bullet, checkbox or numbered item, Enter at the end starts the next item (a new checkbox starts unchecked) and Enter in the middle splits the item. Enter on an empty item ends the list, or moves a nested item out one level. Tab makes the item a sub-item of the one above, carrying its own sub-items along, and Shift+Tab moves it back out. Backspace at the start of the item's text removes the marker, or moves a nested item out one level; at the very start of the line it joins with the line above as usual. Numbered lists renumber themselves whenever items are added, removed, moved or pasted, each nesting level counting on its own from the number of its first item. Ctrl+D checks or unchecks the task box on the cursor's line (- [ ] or - [x], any marker, any indent), gives a list item without a box an unchecked one, and turns any other line, empty or not, into a - [ ] item that keeps its text; each is one undo step. It leaves headings and thematic breaks alone. A checked item's text is dimmed, so finished items recede but stay readable and editable. None of this applies in fenced code or quotes.
Vim keys
Optional Normal, Visual and Insert modes for modal movement and editing.
Vim keys are off by default. Turn them on in the settings panel (Ctrl+P → Vim keys) or set vim = true in ~/.mustty.toml. With vim keys enabled, mustty starts in Normal mode, as vim does, even for a new empty document; press i to start typing. The status bar shows INS, NOR or VIS before the file name. The cursor is a block in Normal and Visual modes and uses your configured shape in Insert mode.
Insert mode uses the default keys above, except Esc switches to Normal mode. All Ctrl keys also work in Normal and Visual modes, and save and quit stay Ctrl+S and Ctrl+Q. Ctrl+D toggles a task box, as in the default keys, rather than scrolling half a page.
| Mode | Key | Action |
|---|---|---|
| Normal | i / a / o / O |
Enter Insert at cursor / after cursor / new line below / new line above (a new item on a list line) |
| Normal | v |
Start character-wise Visual selection |
| Normal | h j k l |
Move cursor (j / k move by screen line) |
| Normal | w / b / e |
Next word / previous word / end of word |
| Normal | 0 / $ |
Start / end of screen line |
| Normal | gg / G |
Start / end of document |
| Normal | x / dd / p |
Delete character / cut line / paste (cut line goes below) |
| Normal | dw / de / db |
Delete to the next word / through the end of the word / back to the start of the word |
| Normal | d0 / d$ |
Delete to the start / through the end of the screen line |
| Normal | dgg / dG |
Delete whole lines up to the start / end of the document |
| Normal | r + a character |
Replace the character under the cursor |
| Normal | u / Ctrl+R |
Undo / redo (Ctrl+R in Normal only; elsewhere Ctrl+Y) |
| Normal | / / n / N |
Find / next match / previous match |
| Normal | gx / Enter |
Open the link under the cursor |
| Normal | ? |
Open keys panel |
| Visual | Move keys, n / N |
Extend selection |
| Visual | y / d or x / p |
Copy / cut / replace selection with register |
| Visual | v or Esc / i |
End selection / switch to Insert |
d also takes h, l, ←, →, Home and End. What it deletes goes to the register, so p puts it back; whole lines (dd, dgg, dG) paste below the cursor's line. dw on the last word of a line stops at the end of the line, and no d joins two lines except de from the last letter of a line, as in vim. Each delete or replace is one undo step. A d or r followed by a key it does not take does nothing.
Arrow keys, Home, End, PgUp and PgDn also work in Normal mode. ?, /, n and N act as commands only in vim modes; otherwise they type the character. This is a deliberately small subset: there are no counts, no c, yy, A, I, ., : commands, registers or text objects, and any other key in Normal mode is ignored.
Find
Search the document body incrementally as you type.
Press Ctrl+F (or / in vim Normal mode) to open Find: in the status bar. Matches update as you type and the view jumps to the first match at or after the cursor, wrapping to the top. Every match is yellow and underlined, with the current match reversed; the right side shows the count (such as 3/12) or No matches.
In the find bar, Enter keeps the cursor on the match and closes (doing nothing when there is no match). Esc or Ctrl+F closes and restores your previous cursor, selection and scroll position. Ctrl+N and Ctrl+B step through matches without closing.
After closing, Ctrl+N and Ctrl+B (vim n and N) repeat the last accepted query, wrapping at both ends, and show Match 3/12 or No matches: <query>. Search is literal text only (no regex) with smart case: an all-lowercase query ignores case, while any capital letter makes it exact. Find searches the body only, never the title, matches do not span lines, and there is no replace.
Settings
Adjust options live in the settings panel or persistently in ~/.mustty.toml.
Press Ctrl+P to open the settings panel. Move with ↑/↓ or Tab/Shift+Tab, and adjust with ←/→ (PgUp/PgDn step numbers by 10, Space flips toggles). Changes preview live, but are not saved until you press Enter; Esc or Ctrl+P rolls them back.
Settings live in ~/.mustty.toml (.mustty.toml in your home directory on Windows), a fixed path with top-level TOML keys and no CLI or environment overrides. It is read at startup only, so hand edits need a restart. Saving from the panel writes only the keys you changed, preserves comments and key order, and follows symlinks.
width = 72
vim = false
autosave = true
autosave_idle_ms = 2000
code_color = "cyan"
cursor = "bar"
| Key | Type | Default | Allowed values | What it does |
|---|---|---|---|---|
width |
int | 72 |
40–120 (clamped) |
Body width in columns (panel step 2) |
vim |
bool | false |
true, false |
Enable vim keys |
mouse |
bool | false |
true, false |
Click to place cursor, drag to select, wheel scrolls 3 rows |
autosave |
bool | true |
true, false |
Autosave on idle, focus loss and quit |
autosave_idle_ms |
int | 2000 |
500–60000 (clamped) |
Autosave idle delay in milliseconds (panel step 500) |
typewriter |
bool | false |
true, false |
Start with typewriter mode on |
focus_mode |
bool | false |
true, false |
Start with focus mode on |
scrolloff |
int | 3 |
0–10 (clamped) |
Scroll margin (panel step 1; inactive in typewriter mode) |
tab_width |
int | 4 |
1–16 (clamped) |
Spaces inserted by Tab (panel step 1) |
code_color |
string | "cyan" |
black, red, green, yellow, blue, magenta, cyan, white (gray = white) |
Code colour (grey, hex and bright* are invalid) |
code_highlight |
bool | true |
true, false |
Highlight fenced code blocks naming a supported language |
link_color |
string | "none" |
none or a code_color name |
Colour of link text and plain URLs (none: underlined, in the text colour) |
rule_lines |
bool | false |
true, false |
Draw ---, *** and ___ as a line across the text column, except while the cursor, the selection or a find match is on it |
cursor |
string | "bar" |
bar, block, underline |
Cursor shape (Insert mode only when vim is true) |
cursor_blink |
bool | false |
true, false |
Blink the cursor (Insert mode only when vim is true) |
lang |
string | "auto" |
auto, en, zh-CN |
UI language (auto checks LC_ALL, LC_MESSAGES, LANG, then system locale) |
String values are case-insensitive. Enabling mouse disables your terminal's own drag-select, so hold Shift while dragging in most terminals to select text for the terminal; mouse is off by default for this reason.
A bad config file never blocks startup. Out-of-range numbers are clamped, wrong types or names fall back for that key only, unknown keys are ignored silently, and a syntax error discards the whole file. Warnings appear in the status bar until the first keypress and on stderr. If the file has a syntax error, the panel applies changes to the current session only and refuses to write the file.
Writing
How mustty formats Markdown, wraps lines, handles focus modes and writes files.
| Topic | Behaviour |
|---|---|
| Width | Centred 40–120 column page (default 72). Narrower terminals keep a 2-column margin, dropping to none under 24 columns. |
| Markdown | Syntax markers stay visible but dimmed while headings, emphasis, code, links, lists and quotes are styled in place. Plain http://, https:// and www. URLs are underlined like link text. Fenced blocks naming one of 30 languages (such as ```rust) are highlighted when code_highlight is on; see the changelog for the list and aliases. |
| Wrapping and CJK | Soft wrapping uses Unicode UAX #14 break opportunities, so mixed English and CJK wrap without closing punctuation starting a line; trailing spaces hang and overlong words are force-broken. Using the real terminal cursor keeps IME candidate windows at the insertion point. |
| Typewriter mode | Ctrl+T keeps the active line in the middle of the screen (scrolloff has no effect while it is on). Key toggles are session-only; typewriter sets the startup state. |
| Focus mode | Ctrl+O dims everything outside the current paragraph (adjacent non-blank lines around the cursor). Key toggles are session-only; focus_mode sets the startup state. |
| Autosave | On by default; writes atomically (temp file and rename) after autosave_idle_ms (2 s) idle, on focus loss and on quit. Untitled documents are never autosaved. Saved state shows as a green ● with no "Saved" message. If the file changes on disk, autosave pauses (File changed on disk, Ctrl+S to overwrite); Ctrl+S overwrites and resumes it. mustty does not reload files. |
| Files and window title | UTF-8 only; an existing BOM, CRLF line endings and final newline are preserved. Files over 5 MB show File is over 5 MB: word count updates on save. The window title shows the document title, else the file name, else Untitled, prefixed with * while unsaved. |
Clipboard and SSH
Copy out over SSH using OSC 52, and paste from the system clipboard via your terminal.
Ctrl+C and Ctrl+X (vim y and d) fill mustty's internal register and also send the text to the system clipboard with OSC 52, which works over SSH.
Ctrl+V (vim p) pastes mustty's internal register only, not the system clipboard. To paste from the system clipboard, use your terminal's paste (Cmd+V, Ctrl+Shift+V or right-click). It arrives as a single bracketed paste and one undo step, and works in vim Normal mode too.
macOS Terminal.app does not support OSC 52; on first copy, mustty shows This terminal doesn't support OSC 52: copied to the internal register, Ctrl+V pastes. Other terminals that drop OSC 52 fail silently. In tmux, enable set -g set-clipboard on so OSC 52 passes through.
Browser demo
How the WebAssembly demo on mustty.com differs from the terminal app.
The demo runs the same editor compiled to WebAssembly inside xterm.js and opens a sample demo.md. Mouse support is enabled, so hold Shift to select text with the browser.
There is no file system: the Open button loads a local UTF-8 .md, .markdown or .txt file, and Download saves it under its name or untitled.md. Ctrl+S and autosave write only to page memory; nothing survives a reload. Settings work for the current session with no config file. Copy stays inside mustty with no system clipboard access and no warning, and Ctrl+Q does nothing.
The Maximize button fills the window; press Esc twice quickly to restore. Option+B and Option+F work as Alt+B and Alt+F.
Troubleshooting
Common terminal issues and how to handle them.
| Issue | What to do |
|---|---|
Window too small |
The terminal is under 10 columns wide; enlarge it. Find also requires the status bar to be visible. |
Not a UTF-8 file (byte N) |
mustty refuses non-UTF-8 files rather than guessing an encoding. Convert the file first (for example with iconv). |
| Copy does not reach the system clipboard | Your terminal does not support OSC 52 (such as macOS Terminal.app). Copy still works inside mustty; to copy out, select with the terminal (hold Shift while dragging when mouse is on). |
Alt+B / Alt+F type characters on macOS |
Configure your terminal to send Option as Meta (Terminal.app: "Use Option as Meta key"), or use Ctrl+← / Ctrl+→. |
Ctrl+B activates tmux |
Ctrl+B is tmux's default prefix; press it twice for previous match, or use N in vim mode. If the cursor stays a block in tmux, check its Ss/Se overrides. |
Ctrl+Backspace behaves unexpectedly |
Both common terminal sequences are handled; Ctrl+W always deletes the previous word. |
| Config warning at startup | See Settings above; the same warning is printed to stderr after exit. |