Expand description
repl-mode — a builtin minor mode contributing the REPL input surface.
The Normal-mode insert-entry keys (i/a/o/A/I/O) don’t insert in
place: they move the caret to the buffer’s prompt (its last line) and enter
Insert. That is the affordance a REPL-like buffer wants — the transcript
above the prompt is read-only, so “start typing” should always land you at
the prompt.
§Why a minor mode, not a major-mode keymap
This behaviour previously lived on ai-conversation-mode, a major mode,
whose keymap overrides vim’s universal insert keys. A major-mode keymap is
gated by the buffer’s active major (K.1.c), but binding the single most
common Normal-mode keys there is fragile — any gap in that gating resurfaces
them everywhere (the :describe-key i / dashboard-jumps-to-EOF saga).
Modelling the affordance as a Manual minor mode that each REPL major
(ai-conversation, and later terminal / claude) pulls in via
Mode::implies keeps it OFF every ordinary buffer
(a regular i stays vim-native), reusable across REPLs, and rides the
well-tested minor-mode keymap gating. The user is free to :set it on any
buffer where it makes sense.
Structs§
- Repl
Mode repl-modeminor. A marker mode: it owns a keymap layer + one action handler, but allocates no per-buffer resources (Guard = ()).
Functions§
- register_
repl_ mode - Register
repl-modeagainstregistry. Called fromregister_foundation_modes— it is a builtin, so there is no separate boot call. - register_
repl_ mode_ actions - Register the
action:repl-focus-inputcommand so the mode’s keymapcmdname resolves at boot (theregister_ai_conversation_actionspattern). Theapplybody is a deadEffect::None: the mode’saction_handlersclosure intercepts before the grammar Action gate, so this never runs. It exists so theCommandIdresolves for the chord binding + handler registration.