Skip to main content

hjkl_vim/
motion.rs

1/// Cursor motion identity carried by the host keymap path.
2///
3/// Phase 3a introduces this enum so the `hjkl-vim` keymap can name motions
4/// without depending on engine internals. The host converts a `MotionKind` to
5/// the appropriate `Editor::apply_motion` call.
6///
7/// Designed for extensibility: Phases 3b–3g will add further variants
8/// (word motions, line-boundary motions, jump motions, scroll motions, …)
9/// without breaking any existing match arms — callers must use `..` or
10/// add the new arms when they bump the hjkl-vim minor version.
11#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
12#[non_exhaustive]
13pub enum MotionKind {
14    /// `h` / `<Backspace>` — move the cursor one character to the left.
15    /// Clamps at column 0 (no line-wrap), matching vim's normal-mode `h`.
16    CharLeft,
17    /// `l` / `<Space>` — move the cursor one character to the right.
18    /// Clamps at the last character of the line (no line-wrap), matching
19    /// vim's normal-mode `l`.
20    CharRight,
21    /// `j` — move the cursor one line down, restoring the sticky column.
22    LineDown,
23    /// `k` — move the cursor one line up, restoring the sticky column.
24    LineUp,
25    /// `+` / `<CR>` (not yet bound) — move down one line and land on the
26    /// first non-blank character. Sets the sticky column.
27    FirstNonBlankDown,
28    /// `-` — move up one line and land on the first non-blank character.
29    /// Sets the sticky column.
30    FirstNonBlankUp,
31}