hjkl-form
Vim-modal forms for hjkl-based apps.
Part of the hjkl monorepo — a vim-modal editor in Rust.
Each text field hosts its own Editor<Buffer, FormFieldHost>, so users get the
full vim grammar (hjkl, wb, ciw, dd, ...) inside form inputs. The form
itself runs a tiny FSM over Form-Normal / Form-Insert modes for focus
navigation, validation, and submit dispatch — keystrokes delegate to the focused
field's editor when the form is in Insert mode.
Renderers live in adapter crates: hjkl-ratatui::form::draw_form ships the
ratatui flavor.
Status
dirty_gen aggregates buffer mutations and form-level focus changes; renderers
can cheap-skip frames when it hasn't advanced.
Usage
= "0.3"
use ;
let mut name = with_meta;
name.validator = Some;
let mut form = new
.with_title
.with_field
.with_field
.with_submit;
// Drive with `Form::handle_input(input)` from your event loop, then call
// `hjkl_ratatui::form::draw_form(...)` per frame.
let _ = form.handle_input;
let _ = Changed;
Key bindings
| Mode | Key | Action |
|---|---|---|
| Form-Normal | j/Tab |
Focus next field |
| Form-Normal | k |
Focus previous field |
| Form-Normal | gg |
Focus first |
| Form-Normal | G |
Focus last |
| Form-Normal | i |
Enter Insert on a text field |
| Form-Normal | Space |
Toggle checkbox / fire submit |
| Form-Normal | h/l |
Cycle select / motion in text |
| Form-Normal | Enter |
Fire submit on Submit field |
| Form-Normal | Esc |
Emit FormEvent::Cancelled |
| Form-Insert | Enter |
Jump to next field (single-line) |
| Form-Insert | Esc |
Return to Form-Normal |
Documentation
Contributing
See the monorepo CONTRIBUTING guide.
License
MIT — see LICENSE.