Skip to main content

Module nvim_host

Module nvim_host 

Source
Expand description

Host-side glue for the Neovim backend.

The backend (NvimBackend) owns the nvim process and its snapshot. This module owns the host policy that sits between that backend and the app: the ZZ/ZQ and :wq/:q quit intercepts, and the per-frame content_gencontent_revision mirror.

As with the decode seam, the fragile part is pulled out as a pure decision (classify_nvim_key) that is fully testable with no nvim process: given the pending-Z state, the key, the mode and the command line, it returns what to do. NvimHost is the thin stateful shell that applies the decision — forwarding to nvim and emitting app events.

Structs§

FrameSync
Values the render loop needs from the Nvim backend each frame.
NvimHost
Host-side Nvim state: the only thing the host must track itself is the pending-Z flag for the ZZ/ZQ two-key sequence.

Enums§

NvimKeyDecision
What a single key should do on the Nvim backend. Pure data — no I/O.
NvimKeyResult
Outcome of applying a key on the Nvim backend. The host bumps the cursor generation only when a key was actually forwarded to nvim.
QuitKind
Where a quit came from. Both side effects the host performs — whether to autosave, and whether to <Esc> nvim out of its current mode first — are derived from this, so a caller never has to coordinate two booleans.

Functions§

classify_nvim_key
Decide what a key does on the Nvim backend. Pure: depends only on the pending-Z flag, the key, the current mode, and the command line.