Skip to main content

Crate hjkl_engine

Crate hjkl_engine 

Source
Expand description

Vim-mode editor engine built on top of hjkl_buffer.

Exposes an Editor you can drop into a ratatui layout, a command grammar that covers the bulk of vim’s normal / insert / visual / visual-line / visual-block modes, text-object operators, dot-repeat, and ex-command handling (:s/foo/bar/g, :w, :q, :noh, …). Rendering goes through hjkl_buffer::BufferView; selection / gutter highlights are painted in the same single-pass as text.

Imported wholesale from sqeel-vim with full git history. The trait extraction (Selection / SelectionSet / Buffer + Host sub-traits per SPEC.md) lands progressively under crate::types. Pre-1.0 churn — the public surface may change in patch bumps.

The legacy public surface is intentionally narrow:

  • Editor — the editor widget.
  • KeybindingMode / VimMode — mode enums used by host apps.
  • [ex::run] / [ex::ExEffect] — drive ex-mode commands.

Re-exports§

pub use types::Attrs;
pub use types::BufferId;
pub use types::Color;
pub use types::CursorShape;
pub use types::Edit as EditOp;
pub use types::EngineError;
pub use types::Highlight;
pub use types::HighlightKind;
pub use types::Host;
pub use types::Input as PlannedInput;
pub use types::Mode;
pub use types::Modifiers;
pub use types::MouseEvent;
pub use types::MouseKind;
pub use types::Options;
pub use types::Pos;
pub use types::Selection;
pub use types::SelectionKind;
pub use types::SelectionSet;
pub use types::SpecialKey;
pub use types::Style;
pub use types::Viewport as PlannedViewport;

Modules§

types
Core types for the planned 0.1.0 trait surface (per SPEC.md).

Structs§

Editor
Input
A key press with modifier flags. The vim engine reads modifiers directly off this struct (e.g. input.ctrl && input.key == Key::Char('d')).
Registers
SearchPrompt
Active / or ? search prompt. Text mutations drive the textarea’s live search pattern so matches highlight as the user types.
Slot

Enums§

Key
A key code, mirroring the subset of crossterm::event::KeyCode the vim engine actually consumes. Null is the conventional sentinel for “no input” (matching the previous tui_textarea::Key shape) so call sites can early-return on unsupported keys.
KeybindingMode
Which keyboard discipline the editor uses. Currently vim-only, but kept as an enum so future emacs / plain bindings can slot in without touching the public signature.
LspIntent
Host-observable LSP requests triggered by editor bindings. The hjkl-engine crate doesn’t talk to an LSP itself — it just raises an intent that the TUI layer picks up and routes to sqls.
VimMode
Coarse vim-mode a host app can display in its status line.