A searchable palette for the micro editor: one keystroke, one query line, one ranked list. The first character of the query picks what is being searched.
| Prefix | Mode | Enter |
|---|---|---|
none, ? |
micro's documentation — every line of every help topic | opens that topic at that line |
= |
options — every registered option, its value and what it does | toggles a boolean, prompts for anything else |
# |
colorschemes, applied live as you move the selection | keeps the previewed scheme |
@ |
open buffers — one row per pane, across every tab | switches to that pane |
/ |
files under the working directory | opens it in the pane you came from |
micro's help text is compiled into the binary with go:embed. There is no
directory on disk, so grep and ripgrep cannot reach it — micro -help,
> help keybindings and reading the source tree are the only ways to answer
"what was that option called again?". config.ReadRuntimeFile is the way in,
and it is only reachable from inside micro.
The option list is the same story from the other side: it is a Go map that no file on disk describes, and the only way to enumerate it is to ask the editor while it is running.
Two things there are worth watching for, because they are the two a screenshot
cannot show. The colorschemes are being applied to the buffer as the selection
moves — that is the real scheme on real code, not a swatch — and esc puts the
original back. Then a help query ranks as it is typed, and enter lands on the
exact line that matched, with its paragraph intact around it.
Every mode, as text:
─────────────────────────────────────────────────────────────────────
> softwrap 3
> options 420 * `softwrap`: wrap lines that are too long to fit
options 510 only does anything if `softwrap` is on.
options 620 "softwrap": false,
─────────────────────────────────────────────────────────────────────
help search: type to filter | up/down select | enter open | esc close
─────────────────────────────────────────────────────────────────────
> =wrap 2
> softwrap false wrap lines that are too long to fit on th
wordwrap false wrap long lines by words, i.e. break at s
─────────────────────────────────────────────────────────────────────
options: type to filter | up/down select | enter set | esc close
─────────────────────────────────────────────────────────────────────
> # 25
> monokai current
atom-dark
bubblegum
─────────────────────────────────────────────────────────────────────
colorschemes: type to filter | up/down preview | enter keep | esc revert
─────────────────────────────────────────────────────────────────────
> @ 3
> palette.lua 1 current ~/code/projects/micro-palette
README.md 1 ~/code/projects/micro-palette
notes.md + 2 ~/notes
─────────────────────────────────────────────────────────────────────
open buffers: type to filter | up/down select | enter switch | esc close
─────────────────────────────────────────────────────────────────────
> /bufpane 300 of 12207+
> bufpane.go internal/action
bufpane_test.go internal/action
─────────────────────────────────────────────────────────────────────
files: type to filter | up/down select | enter open | esc close
The + on the count means the list is still filling, or stopped at its cap.
Add this repo to pluginrepos in ~/.config/micro/settings.json:
"pluginrepos": ["https://raw.githubusercontent.com/vish9812/micro-palette/main/repo.json"]Then:
> plugin install palette
git clone https://github.com/vish9812/micro-palette \
~/.config/micro/plug/paletteEither way, restart micro. Verify with > help palette.
Run > palette, or bind it:
{
"Alt-p": "lua:palette.open"
}| Key | Effect |
|---|---|
| any character | Add to the query |
Backspace |
Delete the last character |
Up / Down |
Move the selection |
PageUp / PageDown |
Move the selection a screen at a time |
Enter |
Act on the selection — see the mode |
Ctrl-x Ctrl-v |
Open it in a horizontal / vertical split |
Ctrl-t |
Open it in a new tab |
Esc |
Close |
The three target keys apply to the modes that open something — files and help.
They are fzf's keys for the same three things. palette.opentarget sets what
plain Enter does (pane, hsplit, vsplit or tab); the keys override it
per-open.
palette.direxclude is the comma-separated list of directory names the file walk
skips, defaulting to .git,.hg,.svn,node_modules,__pycache__,.venv,venv,.gradle, .cache,target,dist,build,vendor. Add to it if a project keeps something big
elsewhere, or take a name out if you keep source in one — target, dist,
build and vendor are ordinary directory names as well as build output. The
list rebuilds the next time you open the mode.
Terms are whitespace-separated and all must appear in the row, in any order,
ignoring case. The left column is searched along with the text, so keybindings bind narrows to one topic.
Results are ranked, not just filtered. In help search, a line that defines
what you searched for — * \softwrap`: wrap lines..., the shape micro's docs use for commands and options — sorts above the prose that merely mentions it. In options, an exact name beats a prefix beats a mention, so ruleris not buried underrelativeruler`.
Help indexes every registered help runtime file: micro's own topics, plus
the help of any plugin you have installed, since plugins publish docs the same
way with config.AddRuntimeFile. Installing more plugins grows the index for
free. It is built on first use and kept for the session.
Options lists every option micro knows about, with the value in effect for
the buffer you opened the palette from and the description from help options.
Plugin-registered options are included, because the list comes from the set
command's own completer rather than from parsing the docs. It is rebuilt every
time you enter the mode, so the values are never stale.
Enter on a boolean option toggles it — there is only one other value, so asking
which one would be a keystroke that tells the palette nothing. Every other
option opens micro's command prompt prefilled with set <option> , where tab
completion works exactly as it does when you type the command yourself.
Files are enumerated once per session in the background by walking the tree,
skipping the directories nobody searches — node_modules, .venv, target and
the others palette.direxclude lists. Dotfiles and anything a .gitignore covers are listed,
because in a text editor those are often exactly what you came for. The walk is
breadth-first, so the shallow files are found first and the cap only ever
truncates the deep tail. Rows stream in and
the mode is usable while it fills; a count ending in + means more are coming,
or that the list stopped at its 20,000 file cap. Ranking is on the file name,
since that is what you type, with a shallower path breaking ties. Enter goes to
the file if it is already open somewhere rather than opening it twice; the
target keys always make a new view, because that is what asking for a split
means. Opening into a pane replaces the buffer that is there, so that case —
and only that case — asks about unsaved changes, the way micro's own open
does.
Open buffers is one row per pane across every tab, in tab bar order, with the pane you came from marked. Panes rather than buffers, because the same file open in two splits is two places you might want to go. Enter switches to it.
Colorschemes are applied as you move, not on enter. micro reloads the
colorscheme the moment the option is set, so the preview is the real scheme on
your real buffers rather than a swatch approximating it. The one you are already
using is first and marked current, so opening the mode changes nothing until
you move; esc puts it back, and so does leaving the mode or the palette by any
other route. Enter is what makes the choice stick, because only enter writes
settings.json — the preview goes through the setter micro exposes to plugins,
which applies an option without saving it.
The list pane, the filter loop and the key handling are shared. A mode is a
provider — rows, a ranking, what enter does, and optionally a live preview —
chosen by the query's first character, the way VS Code uses >, @ and #.
Help, options, colorschemes, open buffers and files are the five.
There is deliberately no commands mode. micro's commands are already searchable
here: help commands is a help topic like any other, so the default mode finds
them with their descriptions and lands you on the line documenting the one you
wanted. A second list of the same names, without the prose, would not have
earned its prefix.
Two things are worth knowing if you read the source:
- Anything that opens or closes a pane is handed to the main loop with
micro.Afterrather than done inside the callback. micro calls plugin callbacks while it is walking its own pane list, and closing the palette from insideonSetActivepanicked the editor outright. ResizePaneon a bottom split sets the height of the pane above it. The palette measures what it got and corrects once.
micro 2.0.15 or newer, on Linux, macOS or Windows. Nothing else — no external binaries, no shell, no subprocess of any kind. Every mode asks only micro, and the files mode walks the tree itself.
- scrollz — viewport control for micro: put the line you are reading where you want it on screen, and move half a screen without losing the cursor.
- ember — four warm truecolor colorschemes for micro, two of them transparent.
- navz — keyboard-first navigation for VS Code: jump to any visible word in two keystrokes.
MIT
