pub trait VimEditorExt {
Show 200 methods
// Required methods
fn visual_block_bounds(&self) -> (usize, usize, usize, usize);
fn block_highlight(&self) -> Option<(usize, usize, usize, usize)>;
fn char_highlight(&self) -> Option<((usize, usize), (usize, usize))>;
fn visual_char_range_exclusive(
&self,
) -> Option<((usize, usize), (usize, usize))>;
fn line_highlight(&self) -> Option<(usize, usize)>;
fn buffer_selection(&self) -> Option<Selection>;
fn selection_highlight(&self) -> Option<Highlight>;
fn text_object_inner_word(&self) -> Option<((usize, usize), (usize, usize))>;
fn text_object_around_word(
&self,
) -> Option<((usize, usize), (usize, usize))>;
fn text_object_inner_big_word(
&self,
) -> Option<((usize, usize), (usize, usize))>;
fn text_object_around_big_word(
&self,
) -> Option<((usize, usize), (usize, usize))>;
fn text_object_inner_quote(
&self,
quote: char,
) -> Option<((usize, usize), (usize, usize))>;
fn text_object_around_quote(
&self,
quote: char,
) -> Option<((usize, usize), (usize, usize))>;
fn text_object_inner_bracket(
&self,
open: char,
) -> Option<((usize, usize), (usize, usize))>;
fn text_object_around_bracket(
&self,
open: char,
) -> Option<((usize, usize), (usize, usize))>;
fn text_object_inner_sentence(
&self,
) -> Option<((usize, usize), (usize, usize))>;
fn text_object_around_sentence(
&self,
) -> Option<((usize, usize), (usize, usize))>;
fn text_object_inner_paragraph(
&self,
) -> Option<((usize, usize), (usize, usize))>;
fn text_object_around_paragraph(
&self,
) -> Option<((usize, usize), (usize, usize))>;
fn text_object_inner_tag(&self) -> Option<((usize, usize), (usize, usize))>;
fn text_object_around_tag(&self) -> Option<((usize, usize), (usize, usize))>;
fn delete_range(
&mut self,
start: (usize, usize),
end: (usize, usize),
kind: RangeKind,
register: char,
);
fn yank_range(
&mut self,
start: (usize, usize),
end: (usize, usize),
kind: RangeKind,
register: char,
);
fn change_range(
&mut self,
start: (usize, usize),
end: (usize, usize),
kind: RangeKind,
register: char,
);
fn indent_range(
&mut self,
start: (usize, usize),
end: (usize, usize),
count: i32,
shiftwidth: u32,
);
fn case_range(
&mut self,
start: (usize, usize),
end: (usize, usize),
kind: RangeKind,
op: Operator,
);
fn delete_block(
&mut self,
top_row: usize,
bot_row: usize,
left_col: usize,
right_col: usize,
register: char,
);
fn yank_block(
&mut self,
top_row: usize,
bot_row: usize,
left_col: usize,
right_col: usize,
register: char,
);
fn change_block(
&mut self,
top_row: usize,
bot_row: usize,
left_col: usize,
right_col: usize,
register: char,
);
fn indent_block(
&mut self,
top_row: usize,
bot_row: usize,
left_col: usize,
right_col: usize,
count: i32,
);
fn auto_indent_range(&mut self, start: (usize, usize), end: (usize, usize));
fn paste_after(&mut self, count: usize);
fn paste_before(&mut self, count: usize);
fn paste_cursor_after(&mut self, before: bool, count: usize);
fn paste_reindent(&mut self, before: bool, count: usize);
fn visual_paste(&mut self, before: bool);
fn adjust_number_visual(&mut self, delta: i64, sequential: bool);
fn ampersand_repeat(&mut self);
fn visual_join(&mut self, with_space: bool);
fn goto_percent(&mut self, count: usize);
fn jump_back(&mut self, count: usize);
fn jump_forward(&mut self, count: usize);
fn search_repeat(&mut self, forward: bool, count: usize);
fn word_search(&mut self, forward: bool, whole_word: bool, count: usize);
fn replace_char_at(&mut self, ch: char, count: usize);
fn find_char(&mut self, ch: char, forward: bool, till: bool, count: usize);
fn after_g(&mut self, ch: char, count: usize);
fn after_z(&mut self, ch: char, count: usize);
fn apply_op_motion(
&mut self,
op: Operator,
motion_key: char,
total_count: usize,
);
fn apply_op_double(&mut self, op: Operator, total_count: usize);
fn apply_op_find(
&mut self,
op: Operator,
ch: char,
forward: bool,
till: bool,
count: usize,
);
fn apply_op_text_obj(
&mut self,
op: Operator,
ch: char,
inner: bool,
total_count: usize,
);
fn apply_op_g(&mut self, op: Operator, ch: char, total_count: usize);
fn vim_mode(&self) -> VimMode;
fn enter_visual_char(&mut self);
fn enter_visual_line(&mut self);
fn enter_visual_block(&mut self);
fn exit_visual_to_normal(&mut self);
fn visual_o_toggle(&mut self);
fn reenter_last_visual(&mut self);
fn set_mode(&mut self, mode: VimMode);
fn visual_anchor(&self) -> (usize, usize);
fn set_visual_anchor(&mut self, anchor: (usize, usize));
fn visual_line_anchor(&self) -> usize;
fn set_visual_line_anchor(&mut self, row: usize);
fn block_anchor(&self) -> (usize, usize);
fn set_block_anchor(&mut self, anchor: (usize, usize));
fn block_vcol(&self) -> usize;
fn set_block_vcol(&mut self, vcol: usize);
fn block_to_eol(&self) -> bool;
fn set_block_to_eol(&mut self, to_eol: bool);
fn set_pending_register_raw(&mut self, reg: Option<char>);
fn take_pending_register_raw(&mut self) -> Option<char>;
fn recording_macro(&self) -> Option<char>;
fn set_recording_macro(&mut self, reg: Option<char>);
fn push_recording_key(&mut self, input: Input);
fn take_recording_keys(&mut self) -> Vec<Input>;
fn set_recording_keys(&mut self, keys: Vec<Input>);
fn recording_keys_len(&self) -> usize;
fn is_replaying_macro_raw(&self) -> bool;
fn set_replaying_macro_raw(&mut self, v: bool);
fn last_macro(&self) -> Option<char>;
fn set_last_macro(&mut self, reg: Option<char>);
fn last_insert_pos(&self) -> Option<(usize, usize)>;
fn set_last_insert_pos(&mut self, pos: Option<(usize, usize)>);
fn last_visual(&self) -> Option<LastVisual>;
fn set_last_visual(&mut self, snap: Option<LastVisual>);
fn insert_pending_register(&self) -> bool;
fn set_insert_pending_register(&mut self, v: bool);
fn change_mark_start(&self) -> Option<(usize, usize)>;
fn take_change_mark_start(&mut self) -> Option<(usize, usize)>;
fn set_change_mark_start(&mut self, pos: Option<(usize, usize)>);
fn is_visual(&self) -> bool;
fn apply_op_with_motion_direct(
&mut self,
op: Operator,
motion: &Motion,
count: usize,
);
fn adjust_number(&mut self, delta: i64);
fn enter_search(&mut self, forward: bool);
fn enter_search_op(&mut self, forward: bool, op: Operator, count: usize);
fn apply_op_search_range(&mut self, op: Operator, origin: (usize, usize));
fn visual_block_insert_at_left(
&mut self,
top: usize,
bot: usize,
col: usize,
count: usize,
);
fn visual_block_append_at_right(
&mut self,
top: usize,
bot: usize,
col: usize,
left: usize,
count: usize,
);
fn execute_motion(&mut self, motion: Motion, count: usize);
fn update_block_vcol(&mut self, motion: &Motion);
fn apply_visual_operator(&mut self, op: Operator, count: usize);
fn replace_block_char(&mut self, ch: char);
fn visual_replace_char(&mut self, ch: char);
fn visual_text_obj_extend(&mut self, ch: char, inner: bool);
fn insert_char(&mut self, ch: char);
fn insert_newline(&mut self);
fn insert_tab(&mut self);
fn insert_backspace(&mut self);
fn insert_delete(&mut self);
fn insert_arrow(&mut self, dir: InsertDir);
fn insert_home(&mut self);
fn insert_end(&mut self);
fn insert_pageup(&mut self, viewport_h: u16);
fn insert_pagedown(&mut self, viewport_h: u16);
fn insert_ctrl_w(&mut self);
fn insert_ctrl_u(&mut self);
fn insert_ctrl_h(&mut self);
fn insert_ctrl_o_arm(&mut self);
fn insert_ctrl_r_arm(&mut self);
fn insert_ctrl_t(&mut self);
fn insert_ctrl_d(&mut self);
fn insert_ctrl_a(&mut self);
fn insert_ctrl_e(&mut self);
fn insert_ctrl_y(&mut self);
fn insert_paste_register(&mut self, reg: char);
fn insert_ctrl_bracket(&mut self);
fn leave_insert_to_normal(&mut self);
fn enter_insert_i(&mut self, count: usize);
fn enter_insert_shift_i(&mut self, count: usize);
fn enter_insert_a(&mut self, count: usize);
fn enter_insert_shift_a(&mut self, count: usize);
fn open_line_below(&mut self, count: usize);
fn open_line_above(&mut self, count: usize);
fn enter_replace_mode(&mut self, count: usize);
fn delete_char_forward(&mut self, count: usize);
fn delete_char_backward(&mut self, count: usize);
fn substitute_char(&mut self, count: usize);
fn substitute_line(&mut self, count: usize);
fn delete_to_eol(&mut self, count: usize);
fn change_to_eol(&mut self, count: usize);
fn yank_to_eol(&mut self, count: usize);
fn join_line(&mut self, count: usize);
fn toggle_case_at_cursor(&mut self, count: usize);
fn replay_last_change(&mut self, count: usize);
fn set_mark_at_cursor(&mut self, ch: char);
fn goto_mark_line(&mut self, ch: char);
fn goto_mark_char(&mut self, ch: char);
fn try_goto_mark_line(&mut self, ch: char) -> MarkJump;
fn try_goto_mark_char(&mut self, ch: char) -> MarkJump;
fn pending(&self) -> Pending;
fn set_pending(&mut self, p: Pending);
fn take_pending(&mut self) -> Pending;
fn count(&self) -> usize;
fn set_count(&mut self, c: usize);
fn accumulate_count_digit(&mut self, digit: usize);
fn reset_count(&mut self);
fn take_count(&mut self) -> usize;
fn fsm_mode(&self) -> Mode;
fn set_fsm_mode(&mut self, m: Mode);
fn is_replaying(&self) -> bool;
fn set_replaying(&mut self, v: bool);
fn is_one_shot_normal(&self) -> bool;
fn set_one_shot_normal(&mut self, v: bool);
fn last_find(&self) -> Option<(char, bool, bool)>;
fn set_last_find(&mut self, target: Option<(char, bool, bool)>);
fn sneak(&mut self, c1: char, c2: char, forward: bool, count: usize);
fn apply_op_sneak(
&mut self,
op: Operator,
c1: char,
c2: char,
forward: bool,
total_count: usize,
);
fn last_sneak(&self) -> Option<((char, char), bool)>;
fn last_change(&self) -> Option<LastChange>;
fn set_last_change(&mut self, lc: Option<LastChange>);
fn last_change_mut(&mut self) -> Option<&mut LastChange>;
fn insert_session(&self) -> Option<&InsertSession>;
fn insert_session_mut(&mut self) -> Option<&mut InsertSession>;
fn take_insert_session(&mut self) -> Option<InsertSession>;
fn set_insert_session(&mut self, s: Option<InsertSession>);
fn pending_register(&self) -> Option<char>;
fn pending_register_is_clipboard(&self) -> bool;
fn recording_register(&self) -> Option<char>;
fn pending_count(&self) -> Option<u32>;
fn pending_op(&self) -> Option<char>;
fn is_chord_pending(&self) -> bool;
fn is_insert_register_pending(&self) -> bool;
fn clear_insert_register_pending(&mut self);
fn set_pending_register(&mut self, reg: char);
fn start_macro_record(&mut self, reg: char);
fn stop_macro_record(&mut self);
fn is_recording_macro(&self) -> bool;
fn is_replaying_macro(&self) -> bool;
fn play_macro(&mut self, reg: char) -> Vec<Input>;
fn end_macro_replay(&mut self);
fn record_input(&mut self, input: Input);
fn force_normal(&mut self);
fn mouse_click_doc(&mut self, row: usize, col: usize);
fn mouse_begin_drag(&mut self);
fn range_for_op_motion(
&mut self,
motion_key: char,
total_count: usize,
) -> Option<(usize, usize)>;
fn apply_motion(&mut self, kind: MotionKind, count: usize);
fn range_for_op_g(
&mut self,
ch: char,
total_count: usize,
) -> Option<(usize, usize)>;
fn range_for_op_text_obj(
&self,
ch: char,
inner: bool,
total_count: usize,
) -> Option<(usize, usize)>;
}Expand description
Vim-discipline read accessors layered onto every Editor<View, H>.
Blanket-implemented below; bring it into scope with
use hjkl_vim::VimEditorExt to call these on an Editor.
Required Methods§
Sourcefn visual_block_bounds(&self) -> (usize, usize, usize, usize)
fn visual_block_bounds(&self) -> (usize, usize, usize, usize)
VisualBlock selection bounds as (top, bot, left, right) — inclusive
rows and inclusive columns, derived from the block anchor and the
cursor’s sticky column. Meaningful only while in VisualBlock mode;
callers that need the “are we in block mode?” guard use
VimEditorExt::block_highlight instead.
Sourcefn block_highlight(&self) -> Option<(usize, usize, usize, usize)>
fn block_highlight(&self) -> Option<(usize, usize, usize, usize)>
The VisualBlock highlight rectangle (top, bot, left, right), or
None when the editor is not in VisualBlock mode.
Sourcefn char_highlight(&self) -> Option<((usize, usize), (usize, usize))>
fn char_highlight(&self) -> Option<((usize, usize), (usize, usize))>
Start/end (row, col) of the active char-wise Visual selection,
positionally ordered. None when not in Visual mode.
When [hjkl_engine::editor::Settings::selection_exclusive] is false
(default, vim behaviour): both endpoints are inclusive — the cells
at start and end are both selected.
When it is true (VSCode bar-cursor behaviour): the range is
half-open — start is included but end is the first cell that is
NOT selected (the caret sits before it). If the selection is empty
(anchor == cursor) None is returned so callers do not need to check
for zero-length ranges.
Sourcefn visual_char_range_exclusive(
&self,
) -> Option<((usize, usize), (usize, usize))>
fn visual_char_range_exclusive( &self, ) -> Option<((usize, usize), (usize, usize))>
Return the half-open exclusive char-visual range (start, end) where
end is the first cell NOT selected (the caret position). None
when not in Visual mode or the selection is empty.
Convenience accessor for the VSCode dispatcher; avoids duplicating the anchor/cursor ordering logic at the call site.
Sourcefn line_highlight(&self) -> Option<(usize, usize)>
fn line_highlight(&self) -> Option<(usize, usize)>
Top/bottom rows of the active VisualLine selection (inclusive).
None when we’re not in VisualLine mode.
Sourcefn buffer_selection(&self) -> Option<Selection>
fn buffer_selection(&self) -> Option<Selection>
Active selection in hjkl_buffer::Selection shape. None when not in
a Visual mode. The host hands this straight to BufferView.
Sourcefn selection_highlight(&self) -> Option<Highlight>
fn selection_highlight(&self) -> Option<Highlight>
Active visual selection as a SPEC Highlight with
HighlightKind::Selection.
Returns None when the editor isn’t in a Visual mode. Visual-line and
visual-block selections collapse to the bounding char range of the
selection — the SPEC Selection kind doesn’t carry sub-line info
today; hosts that need full line / block geometry continue to read
VimEditorExt::buffer_selection (the legacy hjkl_buffer::Selection
shape).
Sourcefn text_object_inner_word(&self) -> Option<((usize, usize), (usize, usize))>
fn text_object_inner_word(&self) -> Option<((usize, usize), (usize, usize))>
Resolve the range of iw (inner word) at the cursor.
An inner word is the contiguous run of keyword characters (or
punctuation characters if the cursor is on punctuation) under the
cursor, without surrounding whitespace. Whitespace-only positions
return None.
Sourcefn text_object_around_word(&self) -> Option<((usize, usize), (usize, usize))>
fn text_object_around_word(&self) -> Option<((usize, usize), (usize, usize))>
Resolve the range of aw (around word) at the cursor.
Like iw but extends the range to include trailing whitespace after
the word. If no trailing whitespace exists, leading whitespace before
the word is absorbed instead (vim :help text-objects behaviour).
Sourcefn text_object_inner_big_word(&self) -> Option<((usize, usize), (usize, usize))>
fn text_object_inner_big_word(&self) -> Option<((usize, usize), (usize, usize))>
Resolve the range of iW (inner WORD) at the cursor.
A WORD is any contiguous run of non-whitespace characters — punctuation is not a word boundary.
Sourcefn text_object_around_big_word(
&self,
) -> Option<((usize, usize), (usize, usize))>
fn text_object_around_big_word( &self, ) -> Option<((usize, usize), (usize, usize))>
Resolve the range of aW (around WORD) at the cursor.
Sourcefn text_object_inner_quote(
&self,
quote: char,
) -> Option<((usize, usize), (usize, usize))>
fn text_object_inner_quote( &self, quote: char, ) -> Option<((usize, usize), (usize, usize))>
Resolve the range of i<quote> (inner quote) at the cursor.
Excludes the quote characters themselves. None when the cursor’s line
contains fewer than two occurrences of quote, or no matching pair can
be found around or ahead of the cursor.
Sourcefn text_object_around_quote(
&self,
quote: char,
) -> Option<((usize, usize), (usize, usize))>
fn text_object_around_quote( &self, quote: char, ) -> Option<((usize, usize), (usize, usize))>
Resolve the range of a<quote> (around quote) at the cursor.
Like i<quote> but includes the quote characters plus surrounding
whitespace on one side: trailing after the closing quote if any exists,
otherwise leading before the opening quote.
Sourcefn text_object_inner_bracket(
&self,
open: char,
) -> Option<((usize, usize), (usize, usize))>
fn text_object_inner_bracket( &self, open: char, ) -> Option<((usize, usize), (usize, usize))>
Resolve the range of i<bracket> (inner bracket pair) at the cursor.
The cursor may be anywhere inside the pair or on a bracket character.
When not inside any pair the resolver falls back to a forward scan
(targets.vim-style: ci( works when the cursor is before ().
Multi-line pairs are supported.
Sourcefn text_object_around_bracket(
&self,
open: char,
) -> Option<((usize, usize), (usize, usize))>
fn text_object_around_bracket( &self, open: char, ) -> Option<((usize, usize), (usize, usize))>
Resolve the range of a<bracket> (around bracket pair) at the cursor.
Like i<bracket> but includes the bracket characters themselves.
Sourcefn text_object_inner_sentence(&self) -> Option<((usize, usize), (usize, usize))>
fn text_object_inner_sentence(&self) -> Option<((usize, usize), (usize, usize))>
Resolve is (inner sentence) at the cursor.
Excludes trailing whitespace. Sentence boundaries follow vim’s is
semantics (period / ? / ! followed by whitespace or
end-of-paragraph).
Sourcefn text_object_around_sentence(
&self,
) -> Option<((usize, usize), (usize, usize))>
fn text_object_around_sentence( &self, ) -> Option<((usize, usize), (usize, usize))>
Resolve as (around sentence) at the cursor.
Like is but includes trailing whitespace after the terminator.
Sourcefn text_object_inner_paragraph(
&self,
) -> Option<((usize, usize), (usize, usize))>
fn text_object_inner_paragraph( &self, ) -> Option<((usize, usize), (usize, usize))>
Resolve ip (inner paragraph) at the cursor.
A paragraph is a block of non-blank lines bounded by blank lines or
buffer edges. None when the cursor is on a blank line.
Sourcefn text_object_around_paragraph(
&self,
) -> Option<((usize, usize), (usize, usize))>
fn text_object_around_paragraph( &self, ) -> Option<((usize, usize), (usize, usize))>
Resolve ap (around paragraph) at the cursor.
Like ip but includes one trailing blank line when present.
Sourcefn text_object_inner_tag(&self) -> Option<((usize, usize), (usize, usize))>
fn text_object_inner_tag(&self) -> Option<((usize, usize), (usize, usize))>
Resolve it (inner tag) at the cursor.
Matches XML/HTML-style <tag>...</tag> pairs, returning the content
between the open and close tags (excluding the tags themselves).
Sourcefn text_object_around_tag(&self) -> Option<((usize, usize), (usize, usize))>
fn text_object_around_tag(&self) -> Option<((usize, usize), (usize, usize))>
Resolve at (around tag) at the cursor.
Like it but includes the open and close tag delimiters.
Sourcefn delete_range(
&mut self,
start: (usize, usize),
end: (usize, usize),
kind: RangeKind,
register: char,
)
fn delete_range( &mut self, start: (usize, usize), end: (usize, usize), kind: RangeKind, register: char, )
Delete the region [start, end) and stash the removed text in
register. '"' selects the unnamed register (vim default);
'a'–'z' select named registers.
Sourcefn yank_range(
&mut self,
start: (usize, usize),
end: (usize, usize),
kind: RangeKind,
register: char,
)
fn yank_range( &mut self, start: (usize, usize), end: (usize, usize), kind: RangeKind, register: char, )
Yank (copy) the region [start, end) into register without mutating
the buffer. '"' selects the unnamed register; '0' the yank-only
register; 'a'–'z' select named registers.
Sourcefn change_range(
&mut self,
start: (usize, usize),
end: (usize, usize),
kind: RangeKind,
register: char,
)
fn change_range( &mut self, start: (usize, usize), end: (usize, usize), kind: RangeKind, register: char, )
Delete the region [start, end) and transition to Insert mode (vim c
operator). The deleted text is stashed in register. On return the
editor is in Insert mode; the caller must not issue further normal-mode
ops until the insert session ends.
Sourcefn indent_range(
&mut self,
start: (usize, usize),
end: (usize, usize),
count: i32,
shiftwidth: u32,
)
fn indent_range( &mut self, start: (usize, usize), end: (usize, usize), count: i32, shiftwidth: u32, )
Indent (count > 0) or outdent (count < 0) the row span
[start.0, end.0]. Column components are ignored — indent is always
linewise. shiftwidth overrides the editor’s configured shiftwidth for
this call; pass 0 to use the current editor setting. count == 0 is
a no-op.
Sourcefn case_range(
&mut self,
start: (usize, usize),
end: (usize, usize),
kind: RangeKind,
op: Operator,
)
fn case_range( &mut self, start: (usize, usize), end: (usize, usize), kind: RangeKind, op: Operator, )
Apply a case transformation (Operator::Uppercase /
Operator::Lowercase / Operator::ToggleCase) to the region
[start, end). Other Operator variants are silently ignored (no-op).
Registers are left untouched — vim’s case operators do not write to
registers.
Sourcefn delete_block(
&mut self,
top_row: usize,
bot_row: usize,
left_col: usize,
right_col: usize,
register: char,
)
fn delete_block( &mut self, top_row: usize, bot_row: usize, left_col: usize, right_col: usize, register: char, )
Delete a rectangular VisualBlock selection.
Sourcefn yank_block(
&mut self,
top_row: usize,
bot_row: usize,
left_col: usize,
right_col: usize,
register: char,
)
fn yank_block( &mut self, top_row: usize, bot_row: usize, left_col: usize, right_col: usize, register: char, )
Yank a rectangular VisualBlock selection into register without
mutating the buffer.
Sourcefn change_block(
&mut self,
top_row: usize,
bot_row: usize,
left_col: usize,
right_col: usize,
register: char,
)
fn change_block( &mut self, top_row: usize, bot_row: usize, left_col: usize, right_col: usize, register: char, )
Delete a rectangular VisualBlock selection and enter Insert mode (c
operator). Mode is Insert on return.
Sourcefn indent_block(
&mut self,
top_row: usize,
bot_row: usize,
left_col: usize,
right_col: usize,
count: i32,
)
fn indent_block( &mut self, top_row: usize, bot_row: usize, left_col: usize, right_col: usize, count: i32, )
Indent (count > 0) or outdent (count < 0) rows top_row..=bot_row.
Column bounds are ignored — vim’s block indent is always linewise.
count == 0 is a no-op.
Sourcefn auto_indent_range(&mut self, start: (usize, usize), end: (usize, usize))
fn auto_indent_range(&mut self, start: (usize, usize), end: (usize, usize))
Auto-indent (v1 dumb shiftwidth) the row span [start.0, end.0].
Column components are ignored — auto-indent is always linewise.
The algorithm is a naive bracket-depth counter: it scans the buffer
from row 0 to compute the correct depth at start.0, then for each
line in the target range strips existing leading whitespace and
prepends depth × indent_unit. Lines whose first non-whitespace
character is a close bracket get one fewer indent level. Empty /
whitespace-only lines are cleared. After the operation the cursor lands
on the first non-whitespace character of start_row (vim parity ==).
v1 limitation: the bracket scan does not detect brackets inside string literals or comments.
Sourcefn paste_after(&mut self, count: usize)
fn paste_after(&mut self, count: usize)
p — paste the unnamed register (or the register selected via "r)
after the cursor. Linewise content opens a new line below; charwise
content is inserted inline. Records Paste { before: false } for ..
Sourcefn paste_before(&mut self, count: usize)
fn paste_before(&mut self, count: usize)
P — paste the unnamed register (or the "r register) before the
cursor. Linewise content opens a new line above; charwise is inline.
Records Paste { before: true } for dot-repeat.
Sourcefn paste_cursor_after(&mut self, before: bool, count: usize)
fn paste_cursor_after(&mut self, before: bool, count: usize)
gp / gP — paste like p/P but leave the cursor just after the
pasted text. before = true for gP.
Sourcefn paste_reindent(&mut self, before: bool, count: usize)
fn paste_reindent(&mut self, before: bool, count: usize)
]p / [p — linewise paste with the pasted block reindented to match
the current line. before = true for [p.
Sourcefn visual_paste(&mut self, before: bool)
fn visual_paste(&mut self, before: bool)
Visual-mode p / P — replace the active selection with the register.
before = true for P (preserves the source register).
Sourcefn adjust_number_visual(&mut self, delta: i64, sequential: bool)
fn adjust_number_visual(&mut self, delta: i64, sequential: bool)
Visual-mode <C-a>/<C-x> (uniform) and g<C-a>/g<C-x>
(sequential) — adjust the first number on each selected line.
Sourcefn ampersand_repeat(&mut self)
fn ampersand_repeat(&mut self)
Normal-mode & — repeat the last :s on the current line (no flags).
Sourcefn visual_join(&mut self, with_space: bool)
fn visual_join(&mut self, with_space: bool)
Visual-mode J (with_space = true) / gJ (false) — join the
selected lines into one.
Sourcefn goto_percent(&mut self, count: usize)
fn goto_percent(&mut self, count: usize)
[count]% — jump to the line at count percent of the file.
Sourcefn jump_back(&mut self, count: usize)
fn jump_back(&mut self, count: usize)
<C-o> — jump back count entries in the jumplist, saving the current
position on the forward stack so <C-i> can return.
Sourcefn jump_forward(&mut self, count: usize)
fn jump_forward(&mut self, count: usize)
<C-i> / Tab — redo count entries on the forward jumplist stack,
saving the current position on the backward stack.
Sourcefn search_repeat(&mut self, forward: bool, count: usize)
fn search_repeat(&mut self, forward: bool, count: usize)
n — repeat the last / or ? search count times in its original
direction. forward = true keeps the direction; false inverts (N).
Sourcefn word_search(&mut self, forward: bool, whole_word: bool, count: usize)
fn word_search(&mut self, forward: bool, whole_word: bool, count: usize)
* / # / g* / g# — search for the word under the cursor.
forward chooses direction; whole_word wraps the pattern in \b
anchors (true for * / #, false for g* / g#). count repeats.
Sourcefn replace_char_at(&mut self, ch: char, count: usize)
fn replace_char_at(&mut self, ch: char, count: usize)
r<x> — replace the char under the cursor with ch, count times.
Cursor ends on the last replaced char; one undo snapshot at start.
Sourcefn find_char(&mut self, ch: char, forward: bool, till: bool, count: usize)
fn find_char(&mut self, ch: char, forward: bool, till: bool, count: usize)
f/F/t/T — find ch on the current line. forward chooses
direction, till stops one char short. Records last_find for ;/,.
Sourcefn after_g(&mut self, ch: char, count: usize)
fn after_g(&mut self, ch: char, count: usize)
Apply the g-chord effect for g<ch> with a pre-captured count.
Sourcefn after_z(&mut self, ch: char, count: usize)
fn after_z(&mut self, ch: char, count: usize)
Apply the z-chord effect for z<ch> with a pre-captured count —
zz/zt/zb (scroll-cursor), the fold ops, and zf.
Sourcefn apply_op_motion(
&mut self,
op: Operator,
motion_key: char,
total_count: usize,
)
fn apply_op_motion( &mut self, op: Operator, motion_key: char, total_count: usize, )
Apply an operator over a single-key motion (e.g. dw, d$, dG).
The engine resolves motion_key to a Motion via parse_motion.
total_count is the folded product of prefix and inner counts. No-op
when motion_key is not a known motion (vim cancels the operator).
Sourcefn apply_op_double(&mut self, op: Operator, total_count: usize)
fn apply_op_double(&mut self, op: Operator, total_count: usize)
Apply a doubled-letter line op (dd / yy / cc / >> / <<).
Sourcefn apply_op_find(
&mut self,
op: Operator,
ch: char,
forward: bool,
till: bool,
count: usize,
)
fn apply_op_find( &mut self, op: Operator, ch: char, forward: bool, till: bool, count: usize, )
Apply an operator over a find motion (df<x> / dF<x> / dt<x> /
dT<x>). Records last_find for ; / , repeat and updates
last_change when op is Change (dot-repeat).
Sourcefn apply_op_text_obj(
&mut self,
op: Operator,
ch: char,
inner: bool,
total_count: usize,
)
fn apply_op_text_obj( &mut self, op: Operator, ch: char, inner: bool, total_count: usize, )
Apply an operator over a text-object range (diw / daw / di" …).
Unknown ch values are silently ignored, matching the FSM.
Sourcefn apply_op_g(&mut self, op: Operator, ch: char, total_count: usize)
fn apply_op_g(&mut self, op: Operator, ch: char, total_count: usize)
Apply an operator over a g-chord motion or case-op linewise form
(dgg / dge / dgE / dgj / dgk / gUgU …).
Sourcefn vim_mode(&self) -> VimMode
fn vim_mode(&self) -> VimMode
The current vim mode (Normal / Insert / Visual / VisualLine / VisualBlock).
Sourcefn enter_visual_char(&mut self)
fn enter_visual_char(&mut self)
v from Normal — enter charwise Visual mode, anchoring the selection
at the current cursor position.
Sourcefn enter_visual_line(&mut self)
fn enter_visual_line(&mut self)
V from Normal — enter linewise Visual mode, anchoring on the current
line. Motions extend the selection by whole lines.
Sourcefn enter_visual_block(&mut self)
fn enter_visual_block(&mut self)
<C-v> from Normal — enter Visual-block mode. The selection is a
rectangle whose corners are the anchor and the live cursor.
Sourcefn exit_visual_to_normal(&mut self)
fn exit_visual_to_normal(&mut self)
Esc from any visual mode — set < / > marks, stash the selection for
gv re-entry, then return to Normal mode.
Sourcefn visual_o_toggle(&mut self)
fn visual_o_toggle(&mut self)
o in Visual / VisualLine / VisualBlock — swap the cursor and anchor so
the user can extend the other end of the selection. Does NOT mutate the
selection range; only the active endpoint changes.
Sourcefn reenter_last_visual(&mut self)
fn reenter_last_visual(&mut self)
gv — restore the last visual selection (mode + anchor + cursor
position). No-op when no visual selection has been exited yet.
Sourcefn set_mode(&mut self, mode: VimMode)
fn set_mode(&mut self, mode: VimMode)
Direct mode-transition entry point. Sets both the internal FSM mode and
the stable current_mode field read by vim_mode().
Prefer the semantic primitives (enter_visual_char, enter_insert_i,
…) which also set up required bookkeeping (anchors, sessions, …). Use
set_mode only when you need a raw mode flip without side-effects.
Sourcefn visual_anchor(&self) -> (usize, usize)
fn visual_anchor(&self) -> (usize, usize)
The charwise Visual-mode anchor (row, col).
Sourcefn set_visual_anchor(&mut self, anchor: (usize, usize))
fn set_visual_anchor(&mut self, anchor: (usize, usize))
Set the charwise Visual-mode anchor.
Sourcefn visual_line_anchor(&self) -> usize
fn visual_line_anchor(&self) -> usize
The linewise Visual-mode anchor row.
Sourcefn set_visual_line_anchor(&mut self, row: usize)
fn set_visual_line_anchor(&mut self, row: usize)
Set the linewise Visual-mode anchor row.
Sourcefn block_anchor(&self) -> (usize, usize)
fn block_anchor(&self) -> (usize, usize)
The VisualBlock anchor (row, col).
Sourcefn set_block_anchor(&mut self, anchor: (usize, usize))
fn set_block_anchor(&mut self, anchor: (usize, usize))
Set the VisualBlock anchor.
Sourcefn block_vcol(&self) -> usize
fn block_vcol(&self) -> usize
The VisualBlock sticky (virtual) column.
Sourcefn set_block_vcol(&mut self, vcol: usize)
fn set_block_vcol(&mut self, vcol: usize)
Set the VisualBlock sticky (virtual) column.
Sourcefn block_to_eol(&self) -> bool
fn block_to_eol(&self) -> bool
Whether the VisualBlock selection is “ragged” ($ was pressed —
:h v_b_$): every row resolves its own right edge to its own EOL
instead of the block’s fixed right column.
Sourcefn set_block_to_eol(&mut self, to_eol: bool)
fn set_block_to_eol(&mut self, to_eol: bool)
Set the VisualBlock ragged ($) flag.
Sourcefn set_pending_register_raw(&mut self, reg: Option<char>)
fn set_pending_register_raw(&mut self, reg: Option<char>)
Set the pending "r register selector without consuming it.
Sourcefn take_pending_register_raw(&mut self) -> Option<char>
fn take_pending_register_raw(&mut self) -> Option<char>
Take (and clear) the pending "r register selector.
Sourcefn recording_macro(&self) -> Option<char>
fn recording_macro(&self) -> Option<char>
Register currently being recorded into via q{reg}, if any.
Sourcefn set_recording_macro(&mut self, reg: Option<char>)
fn set_recording_macro(&mut self, reg: Option<char>)
Set (or clear) the register being recorded into.
Sourcefn push_recording_key(&mut self, input: Input)
fn push_recording_key(&mut self, input: Input)
Append an input to the in-flight macro recording.
Sourcefn take_recording_keys(&mut self) -> Vec<Input>
fn take_recording_keys(&mut self) -> Vec<Input>
Take (and clear) the recorded macro keys.
Sourcefn set_recording_keys(&mut self, keys: Vec<Input>)
fn set_recording_keys(&mut self, keys: Vec<Input>)
Replace the recorded macro keys wholesale.
Sourcefn recording_keys_len(&self) -> usize
fn recording_keys_len(&self) -> usize
Number of keys recorded so far.
Sourcefn is_replaying_macro_raw(&self) -> bool
fn is_replaying_macro_raw(&self) -> bool
Whether a macro is currently being replayed.
Sourcefn set_replaying_macro_raw(&mut self, v: bool)
fn set_replaying_macro_raw(&mut self, v: bool)
Set the macro-replay flag.
Sourcefn last_macro(&self) -> Option<char>
fn last_macro(&self) -> Option<char>
The last macro register played, for @@.
Sourcefn set_last_macro(&mut self, reg: Option<char>)
fn set_last_macro(&mut self, reg: Option<char>)
Set the last macro register played.
Sourcefn last_insert_pos(&self) -> Option<(usize, usize)>
fn last_insert_pos(&self) -> Option<(usize, usize)>
Position where the last insert session ended (gi).
Sourcefn set_last_insert_pos(&mut self, pos: Option<(usize, usize)>)
fn set_last_insert_pos(&mut self, pos: Option<(usize, usize)>)
Set the last insert-session end position.
Sourcefn last_visual(&self) -> Option<LastVisual>
fn last_visual(&self) -> Option<LastVisual>
Snapshot of the last visual selection, for gv.
Sourcefn set_last_visual(&mut self, snap: Option<LastVisual>)
fn set_last_visual(&mut self, snap: Option<LastVisual>)
Set the last-visual snapshot.
Sourcefn insert_pending_register(&self) -> bool
fn insert_pending_register(&self) -> bool
Whether Ctrl-R is armed and awaiting a register name.
Sourcefn set_insert_pending_register(&mut self, v: bool)
fn set_insert_pending_register(&mut self, v: bool)
Set the Ctrl-R pending-register flag.
Sourcefn change_mark_start(&self) -> Option<(usize, usize)>
fn change_mark_start(&self) -> Option<(usize, usize)>
The stashed [ mark start for a Change operation, or None.
Sourcefn take_change_mark_start(&mut self) -> Option<(usize, usize)>
fn take_change_mark_start(&mut self) -> Option<(usize, usize)>
Take (and clear) the stashed [ mark start.
Sourcefn set_change_mark_start(&mut self, pos: Option<(usize, usize)>)
fn set_change_mark_start(&mut self, pos: Option<(usize, usize)>)
Set the stashed [ mark start.
Sourcefn is_visual(&self) -> bool
fn is_visual(&self) -> bool
true when the editor is in any visual mode (Visual / VisualLine /
VisualBlock).
Sourcefn apply_op_with_motion_direct(
&mut self,
op: Operator,
motion: &Motion,
count: usize,
)
fn apply_op_with_motion_direct( &mut self, op: Operator, motion: &Motion, count: usize, )
Apply op over motion with count repetitions, taking the full
vim-quirks path (operator context for l, clamping, etc.).
Sourcefn adjust_number(&mut self, delta: i64)
fn adjust_number(&mut self, delta: i64)
Ctrl-a / Ctrl-x — adjust the number under or after the cursor.
delta = 1 increments, -1 decrements; larger deltas multiply as in
vim’s 5<C-a>.
Sourcefn enter_search(&mut self, forward: bool)
fn enter_search(&mut self, forward: bool)
Open the / or ? search prompt. forward = true for /.
Sourcefn enter_search_op(&mut self, forward: bool, op: Operator, count: usize)
fn enter_search_op(&mut self, forward: bool, op: Operator, count: usize)
d/pat / c/pat / y/pat — open the search prompt in operator-pending
mode so the operator applies over the range to the match on commit.
Sourcefn apply_op_search_range(&mut self, op: Operator, origin: (usize, usize))
fn apply_op_search_range(&mut self, op: Operator, origin: (usize, usize))
Apply a pending operator-search over the exclusive charwise range from
origin to the current cursor (the just-found match position).
Sourcefn visual_block_insert_at_left(
&mut self,
top: usize,
bot: usize,
col: usize,
count: usize,
)
fn visual_block_insert_at_left( &mut self, top: usize, bot: usize, col: usize, count: usize, )
VisualBlock I — enter Insert at the left edge of the block.
count repeats the typed text on every row ([count]I).
Sourcefn visual_block_append_at_right(
&mut self,
top: usize,
bot: usize,
col: usize,
left: usize,
count: usize,
)
fn visual_block_append_at_right( &mut self, top: usize, bot: usize, col: usize, left: usize, count: usize, )
VisualBlock A — enter Insert at the right edge of the block.
col is the append/typed column (one past the block’s right edge,
or the ragged $ column); left is the block’s own left edge,
where the cursor lands on Esc (verified against real nvim — A’s
post-Esc cursor is NOT col on a block wider than one column).
count repeats the typed text on every row ([count]A).
Sourcefn execute_motion(&mut self, motion: Motion, count: usize)
fn execute_motion(&mut self, motion: Motion, count: usize)
Execute a motion, pushing to the jumplist for big jumps and updating the sticky column.
Sourcefn update_block_vcol(&mut self, motion: &Motion)
fn update_block_vcol(&mut self, motion: &Motion)
Update the VisualBlock virtual column after a motion. Horizontal motions
sync block_vcol to the cursor column; vertical motions leave it alone
so the intended column survives clamping to shorter rows.
Sourcefn apply_visual_operator(&mut self, op: Operator, count: usize)
fn apply_visual_operator(&mut self, op: Operator, count: usize)
Apply op over the current visual selection (char-wise, linewise, or
block).
Sourcefn replace_block_char(&mut self, ch: char)
fn replace_block_char(&mut self, ch: char)
VisualBlock r<ch> — replace every character cell in the block with
ch.
Sourcefn visual_replace_char(&mut self, ch: char)
fn visual_replace_char(&mut self, ch: char)
Charwise (v) / linewise (V) Visual-mode r<ch> — replace every
character in the selection with ch (B2). Newlines are preserved;
registers are untouched.
Sourcefn visual_text_obj_extend(&mut self, ch: char, inner: bool)
fn visual_text_obj_extend(&mut self, ch: char, inner: bool)
Visual-mode i<ch> / a<ch> — extend the selection to cover the text
object identified by ch.
Sourcefn insert_char(&mut self, ch: char)
fn insert_char(&mut self, ch: char)
Insert ch at the cursor. In Replace mode, overstrike the cell under
the cursor instead; at end-of-line, always appends. With smartindent,
closing brackets trigger a one-unit dedent on an otherwise-whitespace
line.
Sourcefn insert_newline(&mut self)
fn insert_newline(&mut self)
Insert a newline, applying autoindent / smartindent.
Sourcefn insert_tab(&mut self)
fn insert_tab(&mut self)
Insert a tab (or spaces to the next softtabstop boundary under
expandtab).
Sourcefn insert_backspace(&mut self)
fn insert_backspace(&mut self)
Backspace. Deletes a whole soft-tab run at an aligned boundary under
softtabstop; joins with the previous line at column 0.
Sourcefn insert_delete(&mut self)
fn insert_delete(&mut self)
Delete the char under the cursor; joins with the next line at EOL.
Sourcefn insert_arrow(&mut self, dir: InsertDir)
fn insert_arrow(&mut self, dir: InsertDir)
Arrow-key motion in Insert, breaking the undo group per
undo_break_on_motion.
Sourcefn insert_home(&mut self)
fn insert_home(&mut self)
Home in Insert.
Sourcefn insert_end(&mut self)
fn insert_end(&mut self)
End in Insert.
Sourcefn insert_pageup(&mut self, viewport_h: u16)
fn insert_pageup(&mut self, viewport_h: u16)
PageUp in Insert.
Sourcefn insert_pagedown(&mut self, viewport_h: u16)
fn insert_pagedown(&mut self, viewport_h: u16)
PageDown in Insert.
Sourcefn insert_ctrl_w(&mut self)
fn insert_ctrl_w(&mut self)
Ctrl-W — delete the word before the cursor.
Sourcefn insert_ctrl_u(&mut self)
fn insert_ctrl_u(&mut self)
Ctrl-U — delete to the start of the line.
Sourcefn insert_ctrl_h(&mut self)
fn insert_ctrl_h(&mut self)
Ctrl-H — backspace equivalent.
Sourcefn insert_ctrl_o_arm(&mut self)
fn insert_ctrl_o_arm(&mut self)
Ctrl-O — arm a one-shot Normal-mode command.
Sourcefn insert_ctrl_r_arm(&mut self)
fn insert_ctrl_r_arm(&mut self)
Ctrl-R — arm register paste; the next char names the register.
Sourcefn insert_ctrl_t(&mut self)
fn insert_ctrl_t(&mut self)
Ctrl-T — indent the current line one shiftwidth.
Sourcefn insert_ctrl_d(&mut self)
fn insert_ctrl_d(&mut self)
Ctrl-D — dedent the current line one shiftwidth.
Sourcefn insert_ctrl_a(&mut self)
fn insert_ctrl_a(&mut self)
Ctrl-A — insert the text typed during the most recent insert
session (vim’s “.” register).
Sourcefn insert_ctrl_e(&mut self)
fn insert_ctrl_e(&mut self)
Ctrl-E — insert the char in the same column of the line below.
Sourcefn insert_ctrl_y(&mut self)
fn insert_ctrl_y(&mut self)
Ctrl-Y — insert the char in the same column of the line above.
Sourcefn insert_paste_register(&mut self, reg: char)
fn insert_paste_register(&mut self, reg: char)
Paste register reg at the cursor (the Ctrl-R follow-up).
Sourcefn insert_ctrl_bracket(&mut self)
fn insert_ctrl_bracket(&mut self)
Ctrl-[ — expand any pending abbreviation (Esc-equivalent trigger).
Sourcefn leave_insert_to_normal(&mut self)
fn leave_insert_to_normal(&mut self)
Esc from Insert — end the insert session and return to Normal.
Sourcefn enter_insert_i(&mut self, count: usize)
fn enter_insert_i(&mut self, count: usize)
i — insert before the cursor, count times on commit.
Sourcefn enter_insert_shift_i(&mut self, count: usize)
fn enter_insert_shift_i(&mut self, count: usize)
I — insert at the first non-blank of the line.
Sourcefn enter_insert_a(&mut self, count: usize)
fn enter_insert_a(&mut self, count: usize)
a — append after the cursor.
Sourcefn enter_insert_shift_a(&mut self, count: usize)
fn enter_insert_shift_a(&mut self, count: usize)
A — append at end-of-line.
Sourcefn open_line_below(&mut self, count: usize)
fn open_line_below(&mut self, count: usize)
o — open a new line below and insert.
Sourcefn open_line_above(&mut self, count: usize)
fn open_line_above(&mut self, count: usize)
O — open a new line above and insert.
Sourcefn enter_replace_mode(&mut self, count: usize)
fn enter_replace_mode(&mut self, count: usize)
R — enter Replace mode.
Sourcefn delete_char_forward(&mut self, count: usize)
fn delete_char_forward(&mut self, count: usize)
x — delete count chars forward.
Sourcefn delete_char_backward(&mut self, count: usize)
fn delete_char_backward(&mut self, count: usize)
X — delete count chars backward.
Sourcefn substitute_char(&mut self, count: usize)
fn substitute_char(&mut self, count: usize)
s — substitute count chars (delete then insert).
Sourcefn substitute_line(&mut self, count: usize)
fn substitute_line(&mut self, count: usize)
S — substitute whole lines.
Sourcefn delete_to_eol(&mut self, count: usize)
fn delete_to_eol(&mut self, count: usize)
D — delete to end-of-line ([count]D extends down count-1 lines).
Sourcefn change_to_eol(&mut self, count: usize)
fn change_to_eol(&mut self, count: usize)
C — change to end-of-line ([count]C extends down count-1 lines).
Sourcefn yank_to_eol(&mut self, count: usize)
fn yank_to_eol(&mut self, count: usize)
Y — yank to end-of-line.
Sourcefn toggle_case_at_cursor(&mut self, count: usize)
fn toggle_case_at_cursor(&mut self, count: usize)
~ — toggle case of count chars, advancing right.
Sourcefn replay_last_change(&mut self, count: usize)
fn replay_last_change(&mut self, count: usize)
. — dot-repeat: replay the last buffered change at the cursor. A
non-zero count replaces the change’s stored count (:h . — 3x
then 2. deletes 2, not 6); count == 0 means no explicit count.
Sourcefn set_mark_at_cursor(&mut self, ch: char)
fn set_mark_at_cursor(&mut self, ch: char)
m{ch} — record a mark named ch at the current cursor position.
Invalid chars are silently ignored.
Sourcefn goto_mark_line(&mut self, ch: char)
fn goto_mark_line(&mut self, ch: char)
'{ch} — jump to mark ch, linewise (row, first non-blank). Pushes the
pre-jump position onto the jumplist if the cursor actually moved.
Sourcefn goto_mark_char(&mut self, ch: char)
fn goto_mark_char(&mut self, ch: char)
`{ch} — jump to mark ch, charwise (exact row + col). Pushes the
pre-jump position onto the jumplist if the cursor actually moved.
Sourcefn try_goto_mark_line(&mut self, ch: char) -> MarkJump
fn try_goto_mark_line(&mut self, ch: char) -> MarkJump
Like VimEditorExt::goto_mark_line, but reports cross-buffer jumps:
uppercase marks ('A'–'Z') living in another buffer return
MarkJump::CrossBuffer so the app can switch slots first.
Sourcefn try_goto_mark_char(&mut self, ch: char) -> MarkJump
fn try_goto_mark_char(&mut self, ch: char) -> MarkJump
Charwise counterpart of VimEditorExt::try_goto_mark_line.
Sourcefn set_pending(&mut self, p: Pending)
fn set_pending(&mut self, p: Pending)
Overwrite the pending chord state.
Sourcefn take_pending(&mut self) -> Pending
fn take_pending(&mut self) -> Pending
Atomically take the pending chord, replacing it with Pending::None.
Sourcefn set_count(&mut self, c: usize)
fn set_count(&mut self, c: usize)
Overwrite the digit-prefix count directly. Clamped at
crate::vim::MAX_COUNT (vim’s documented count ceiling, :h count).
Sourcefn accumulate_count_digit(&mut self, digit: usize)
fn accumulate_count_digit(&mut self, digit: usize)
Accumulate one more digit into the count prefix (mirrors count * 10 + digit).
Sourcefn reset_count(&mut self)
fn reset_count(&mut self)
Reset the count prefix to zero (no pending count).
Sourcefn take_count(&mut self) -> usize
fn take_count(&mut self) -> usize
Consume the count and return it; resets to zero. Returns 1 when no
prefix was typed (mirrors take_count in vim.rs).
Sourcefn set_fsm_mode(&mut self, m: Mode)
fn set_fsm_mode(&mut self, m: Mode)
Overwrite the FSM-internal mode without side-effects. Prefer the
semantic primitives (enter_insert_i, enter_visual_char, …).
Sourcefn is_replaying(&self) -> bool
fn is_replaying(&self) -> bool
true while the . dot-repeat replay is running.
Sourcefn set_replaying(&mut self, v: bool)
fn set_replaying(&mut self, v: bool)
Set or clear the dot-replay flag.
Sourcefn is_one_shot_normal(&self) -> bool
fn is_one_shot_normal(&self) -> bool
true when we entered Normal from Insert via Ctrl-o and will return
to Insert after the next complete command.
Sourcefn set_one_shot_normal(&mut self, v: bool)
fn set_one_shot_normal(&mut self, v: bool)
Set or clear the Ctrl-o one-shot-normal flag.
Sourcefn last_find(&self) -> Option<(char, bool, bool)>
fn last_find(&self) -> Option<(char, bool, bool)>
Return the last f/F/t/T target as (char, forward, till), or
None before any find command was executed.
Sourcefn set_last_find(&mut self, target: Option<(char, bool, bool)>)
fn set_last_find(&mut self, target: Option<(char, bool, bool)>)
Overwrite the stored last-find target.
Sourcefn sneak(&mut self, c1: char, c2: char, forward: bool, count: usize)
fn sneak(&mut self, c1: char, c2: char, forward: bool, count: usize)
Perform a vim-sneak style two-char digraph jump. Scans the buffer
from the current cursor for the count-th occurrence of c1+c2.
forward=true searches ahead; forward=false searches backward.
Respects Settings::motion_sneak — callers (hjkl-vim FSM) should
already gate on the setting; this method always executes the sneak.
Sourcefn apply_op_sneak(
&mut self,
op: Operator,
c1: char,
c2: char,
forward: bool,
total_count: usize,
)
fn apply_op_sneak( &mut self, op: Operator, c1: char, c2: char, forward: bool, total_count: usize, )
Apply an operator over a sneak digraph range. Charwise exclusive — deletes from cursor up to (not including) the first char of the match.
Sourcefn last_sneak(&self) -> Option<((char, char), bool)>
fn last_sneak(&self) -> Option<((char, char), bool)>
Return the last sneak digraph and direction stored after a sneak motion.
Some(((c1, c2), forward)) when a sneak has been performed this session;
None before any sneak. Used by ;/, repeat and tests.
Sourcefn last_change(&self) -> Option<LastChange>
fn last_change(&self) -> Option<LastChange>
Return a clone of the last recorded mutating change, or None before
any change has been made.
Sourcefn set_last_change(&mut self, lc: Option<LastChange>)
fn set_last_change(&mut self, lc: Option<LastChange>)
Overwrite the stored last-change record.
Sourcefn last_change_mut(&mut self) -> Option<&mut LastChange>
fn last_change_mut(&mut self) -> Option<&mut LastChange>
Borrow the last-change record mutably (e.g. to fill in an inserted
field after the insert session completes).
Sourcefn insert_session(&self) -> Option<&InsertSession>
fn insert_session(&self) -> Option<&InsertSession>
Borrow the active insert session, or None when not in Insert mode.
Sourcefn insert_session_mut(&mut self) -> Option<&mut InsertSession>
fn insert_session_mut(&mut self) -> Option<&mut InsertSession>
Borrow the active insert session mutably.
Sourcefn take_insert_session(&mut self) -> Option<InsertSession>
fn take_insert_session(&mut self) -> Option<InsertSession>
Atomically take the insert session out, leaving None.
Sourcefn set_insert_session(&mut self, s: Option<InsertSession>)
fn set_insert_session(&mut self, s: Option<InsertSession>)
Install a new insert session, replacing any existing one.
Sourcefn pending_register(&self) -> Option<char>
fn pending_register(&self) -> Option<char>
Return the user’s pending register selection (set via "<reg> chord
before an operator). None if no register was selected — caller should
use the unnamed register ".
Read-only — does not consume / clear the pending selection. The register is cleared by the engine after the next operator fires.
Promoted in 0.6.X for Phase 4e to let the App’s visual-op dispatch arm
honor "a + visual op chord sequences.
Sourcefn pending_register_is_clipboard(&self) -> bool
fn pending_register_is_clipboard(&self) -> bool
True when the user’s pending register selector is + or *.
the host peeks this so it can refresh sync_clipboard_register
only when a clipboard read is actually about to happen.
Sourcefn recording_register(&self) -> Option<char>
fn recording_register(&self) -> Option<char>
Register currently being recorded into via q{reg}. None when
no recording is active. Hosts use this to surface a “recording @r”
indicator in the status line.
Sourcefn pending_count(&self) -> Option<u32>
fn pending_count(&self) -> Option<u32>
Pending repeat count the user has typed but not yet resolved
(e.g. pressing 5 before d). None when nothing is pending.
Hosts surface this in a “showcmd” area.
Sourcefn pending_op(&self) -> Option<char>
fn pending_op(&self) -> Option<char>
The operator character for any in-flight operator that is waiting
for a motion (e.g. d after the user types d but before a
motion). Returns None when no operator is pending.
Sourcefn is_chord_pending(&self) -> bool
fn is_chord_pending(&self) -> bool
true when the engine is in any pending chord state — waiting for
the next key to complete a command (e.g. r<char> replace,
f<char> find, m<a> set-mark, '<a> goto-mark, operator-pending
after d / c / y, g-prefix continuation, z-prefix continuation,
register selection "<reg>, macro recording target, etc).
Hosts use this to bypass their own chord dispatch (keymap tries, etc.) and forward keys directly to the engine so in-flight commands can complete without the host eating their continuation keys.
Sourcefn is_insert_register_pending(&self) -> bool
fn is_insert_register_pending(&self) -> bool
true when insert_ctrl_r_arm() has been called and the dispatcher
is waiting for the next typed character to name the register to paste.
The dispatcher should call insert_paste_register(c) instead of
insert_char(c) for the next printable key, then the flag auto-clears.
Phase 6.5: exposed so the app-level dispatch_insert_key can branch
without having to drive the full FSM.
Sourcefn clear_insert_register_pending(&mut self)
fn clear_insert_register_pending(&mut self)
Clear the Ctrl-R register-paste pending flag. Call this immediately
before insert_paste_register(c) in app-level dispatchers so that the
flag does not persist into the next key. Call before
insert_paste_register_bridge (which hjkl_vim::insert does).
Phase 6.5: used by dispatch_insert_key in the app crate.
Sourcefn set_pending_register(&mut self, reg: char)
fn set_pending_register(&mut self, reg: char)
Set vim.pending_register to Some(reg) if reg is a valid register
selector (a–z, A–Z, 0–9, ", +, *, _). Invalid
chars are silently ignored (no-op), matching the engine FSM’s
handle_select_register behaviour.
Promoted to the public surface in 0.5.17 so the hjkl-vim
PendingState::SelectRegister reducer can dispatch SetPendingRegister
without re-entering the engine FSM. handle_select_register (engine FSM
path for macro-replay / defensive coverage) delegates here to avoid
logic duplication.
Sourcefn start_macro_record(&mut self, reg: char)
fn start_macro_record(&mut self, reg: char)
Begin recording keystrokes into register reg. The caller (app) is
responsible for stopping the recording via stop_macro_record when the
user presses bare q.
- Uppercase
reg(e.g.'A') appends to the existing lowercase recording by pre-seedingrecording_keyswith the decoded text of the matching lowercase register, matching vim’s capital-register append semantics. - Lowercase
regclearsrecording_keys(fresh recording). - Invalid chars (non-alphabetic, non-digit) are silently ignored.
Promoted to the public surface in Phase 5b so the app’s
route_chord_key can start a recording without re-entering the engine
FSM. handle_record_macro_target (engine FSM path for macro-replay
defensive coverage) continues to use the same logic via delegation.
Sourcefn stop_macro_record(&mut self)
fn stop_macro_record(&mut self)
Finalize the active recording: encode recording_keys as text and write
to the matching (lowercase) named register. Clears both recording_macro
and recording_keys. No-ops if no recording is active.
Promoted to the public surface in Phase 5b so the app’s QChord action
can stop a recording when the user presses bare q without re-entering
the engine FSM.
Sourcefn is_recording_macro(&self) -> bool
fn is_recording_macro(&self) -> bool
Returns true while a q{reg} recording is in progress.
Hosts use this to show a “recording @r” status indicator and to decide
whether bare q should stop the recording or open the RecordMacroTarget
chord.
Sourcefn is_replaying_macro(&self) -> bool
fn is_replaying_macro(&self) -> bool
Returns true while a macro is being replayed. The app sets this flag
(via play_macro) and clears it (via end_macro_replay) around the
re-feed loop so the recorder hook can skip double-capture.
Sourcefn play_macro(&mut self, reg: char) -> Vec<Input>
fn play_macro(&mut self, reg: char) -> Vec<Input>
Decode the named register reg into a Vec<hjkl_engine::input::Input> and
prepare for replay, returning ONE iteration of the inputs the app
should re-feed through route_chord_key.
Count semantics live in the HOST: 3@a replays the returned keys
three times by looping (or re-splicing a work queue), never by
materializing keys × count up front — an unclamped 999999999@a
would otherwise allocate multi-GB before the first key plays
(audit R2).
Resolves reg:
'@'→ usevim.last_macro; returns empty vec if none.- Any other char → lowercase it, read the register, decode.
Side-effects:
- Sets
vim.last_macroto the resolved register. - Sets
vim.replaying_macro = trueso the recorder hook skips during replay. The app callsend_macro_replayafter the loop finishes.
Returns an empty vec (and no side-effects for '@') if the register is
unset or empty.
Sourcefn end_macro_replay(&mut self)
fn end_macro_replay(&mut self)
Clear the replaying_macro flag. Called by the app after the
re-feed loop in the PlayMacro commit arm completes (or aborts).
Sourcefn record_input(&mut self, input: Input)
fn record_input(&mut self, input: Input)
Append input to the active recording (recording_keys) if and only
if a recording is in progress AND we are not currently replaying.
Called by the app’s route_chord_key recorder hook so that user
keystrokes captured through the app-level chord path are recorded
(rather than relying solely on the engine FSM’s in-step hook).
Sourcefn force_normal(&mut self)
fn force_normal(&mut self)
Force back to Normal mode (used when dismissing completions etc.).
Sourcefn mouse_click_doc(&mut self, row: usize, col: usize)
fn mouse_click_doc(&mut self, row: usize, col: usize)
Handle a left-button click at doc-space (row, col). Exits Visual mode
if active, breaks the insert-mode undo group (vim parity for
undo_break_on_motion), then moves the cursor. The EOL clamp is
mode-aware (neovim parity): Normal/Visual cap at len - 1, Insert
allows the one-past-EOL position.
Sourcefn mouse_begin_drag(&mut self)
fn mouse_begin_drag(&mut self)
Begin a mouse-drag selection: anchor at the cursor and enter Visual-char mode. Idempotent if already in Visual-char.
Sourcefn range_for_op_motion(
&mut self,
motion_key: char,
total_count: usize,
) -> Option<(usize, usize)>
fn range_for_op_motion( &mut self, motion_key: char, total_count: usize, ) -> Option<(usize, usize)>
Dry-run motion_key and return the (min_row, max_row) span between
the cursor row and the motion’s target row, restoring the cursor
afterwards. None when motion_key is not a known motion.
Sourcefn apply_motion(&mut self, kind: MotionKind, count: usize)
fn apply_motion(&mut self, kind: MotionKind, count: usize)
Execute a named cursor motion kind, repeated count times. Maps the
keymap-layer MotionKind onto the vim motion primitives, bypassing the
FSM. Identical cursor semantics to the FSM path — sticky column, scroll
sync and big-jump tracking all apply.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".