Expand description
Which-key — the pending-chord discoverability subsystem.
Design: docs/dev/architecture/which-key.md (§3 ownership, §5
lifecycle, §8 options). Slice plan:
docs/dev/operations/slice-plans/archive/which-key.md (WK.6).
Hold a prefix; after a short idle delay a popup shows what can come
next, derived from the live composite keymap the dispatcher itself
walks — never from the static catalog (design §2, and the bug
:describe-bindings still has).
§Shape
Four moving parts, all owned here:
installwires the subsystem against the genericSubsystemBootsurface. It adds ZEROEditor::methods and ZERO hostActionvariants — the mode-ownership acid test.- A
PartialChordPendingsubscription stashes the payload and arms an idle gate. - The gate’s handler builds the model + grid and emits
Effect::OpenPopup. WhichKeyModeis the popup buffer’s major mode; itson_activatewrites the stashed grid into the buffer it was activated on.
§The popup is passive
PopupFocus::Passive — the document keeps focus, the caret and the
modal state, so every keystroke continues to flow to the trie
unchanged. A hint that changed what a chord does would be a vim
deviation nobody asked for, and one that failed differently for every
prefix (a transient-style takeover’s <C-n> shadows a real n
continuation under <C-w>, and a real j under g) is the worst
shape of that failure. See design §7.
Structs§
- Which
Key - Pending-chord discoverability.
- Which
KeyDelay - Milliseconds a prefix must sit pending before the popup appears.
0shows it immediately. The delay is what separates a hint from a stutter: a user who knows their chord finishes it well inside the window and never sees a frame of popup. - Which
KeyEnabled - Show the pending-chord popup at all.
- Which
KeyGrid - The grid cell
installcreated, handed towireso both halves write and read the same one. Opaque: the host only carries it between the two calls. - Which
KeyMax Columns - Maximum grid columns.
- Which
KeyMax Height - Maximum content rows. Hard-capped at half the pane regardless.
- Which
KeyMode - Major mode for
*which-key*. - Which
KeySort - Row ordering:
key(digits, lowercase, uppercase, punctuation, special, modifier-bearing) orlabel.
Constants§
- WHICH_
KEY_ BUFFER_ NAME - The popup buffer’s registered name.