OpenProgram Docs

Vim mode in the prompt inputs

/vim editor.vim_modeconfig.json · settings topic Web composer TUI input apps/web/lib/vim/vim.ts

Peers

HarnessTurned on byStarts inShownShape
Codex CLI/vimINSERT"Vim: Normal" / "Vim: Insert" in the footerModes, motions, operators, . repeat, replace mode, its own undo
Oh My Pitui.vimMode settingINSERTNORMAL / VISUAL / REPLACE in the status line; nothing for INSERTA pure state machine returning edits; Enter, Tab and chords fall through to the host; an open popup takes Escape first; a quiet NORMAL hands Escape back
Claude Code/vim, editorMode settingINSERTMode under the promptMotions, operators, text objects, .
Antigravity CLIeditorMode: "vim"NORMAL; INSERT with vimInsertFirstMode badge in the status lineModes, Visual, motions, operators; also the review comment editors
Grok Build/vim-moden/an/aVim keys for the scrollback, not the prompt

Taken from Oh My Pi: the pure machine and its key rules. From Codex and Claude Code: /vim as the switch, . repeat and its own undo. From Codex: a label for both modes, so a person can tell at a glance that Vim mode is on.

Design

PartRule
MachinevimKey(state, {text, cursor}, key) returns the new state and buffer and whether it took the key. No imports, no DOM, no terminal. The TUI imports the file through apps/cli/src/utils/vim.ts and esbuild bundles it.
INSERTThe input's own editing: the slash and file menus, paste chips, history recall and IME keep working. Only Escape is taken, unless a menu is open.
NORMALEvery printable key is taken; an unknown one does nothing rather than typing. Enter, arrows, Tab and chords other than Ctrl-r stay with the input, so Enter sends in both modes as in every peer.
EscapeINSERT to NORMAL; in NORMAL it cancels a pending command, otherwise it goes to the input: the Web composer and the TUI stop a running turn. Idle, the TUI does nothing instead of clearing the draft as its plain Esc does.
UndoThe machine keeps its own snapshots, so the TUI, which has no undo, and the Web editor behave the same. One INSERT stretch is one step. A submit or a draft switch drops the history and returns to INSERT; the paste register stays.
.The last change's keys, plus the text typed in its INSERT stretch, replayed on the current buffer; a count replaces the original one.
Settingeditor.vim_mode, a live toggle, off by default. /vim is a shared built-in (openprogram/runtime/commands/vim_mode.py) that writes it and signals the settings topic. The Web reads /api/settings?scope=editor through the Settings cache; the TUI reads it on connect, on a changed frame for settings and on the /vim reply.
LabelThe only visual change. Web: the Nova Badge at the end of the input's first line, accent for NORMAL and secondary for INSERT. TUI: the mode at the right end of the input box after any hint, accent colour for NORMAL. Off, neither is drawn.

Implementation status

Implemented as described. Not included: Visual and replace modes, named registers, macros, search, : commands, text objects other than iw aw iW aW, insert counts (3ix), a block cursor in NORMAL, j/k history recall at the first or last line.

Last updated · 2026-11-30