Add Vim character find and till motions (#40785)

## What changed

- Add line-local `f`, `F`, `t`, and `T` motions to Vim normal mode.
- Support the motions with `c`, `d`, and `y`, including dot-repeat for changes.
- Expose separate configurable normal-mode and operator-motion bindings, while preserving existing custom keymaps that use the new defaults.
- Keep character targeting aligned to extended grapheme boundaries and skip embedded composer elements.

## Testing

- Cover forward and backward motion and operator ranges, missing and adjacent targets, cancellation, dot-repeat, custom bindings, shifted terminal key events, grapheme clusters, and embedded elements.

GitOrigin-RevId: 2610cf9a13538d9ae9b890c01417ca25316c1d60
This commit is contained in:
Benjamin Carlsson authored and copyberry committed 2026-08-26 04:18:49 +00:00
1 parent 25a6e316c8
commit 98ee29c7cd
16 files changed
+703 -13

No files matched your search

+16
View File
@@ -235,6 +235,14 @@ pub struct TuiVimNormalKeymap {
pub move_line_start: Option<KeybindingsSpec>,
/// Move cursor to end of line (`$`).
pub move_line_end: Option<KeybindingsSpec>,
/// Find the next character on the current line (`f`).
pub find_forward: Option<KeybindingsSpec>,
/// Find the previous character on the current line (`F`).
pub find_backward: Option<KeybindingsSpec>,
/// Stop before the next character on the current line (`t`).
pub till_forward: Option<KeybindingsSpec>,
/// Stop after the previous character on the current line (`T`).
pub till_backward: Option<KeybindingsSpec>,
/// Delete character under cursor (`x`).
pub delete_char: Option<KeybindingsSpec>,
/// Replace the character under the cursor (`r`).
@@ -292,6 +300,14 @@ pub struct TuiVimOperatorKeymap {
pub motion_line_start: Option<KeybindingsSpec>,
/// Motion: to end of line (`$`).
pub motion_line_end: Option<KeybindingsSpec>,
/// Motion: find the next character on the current line (`f`).
pub motion_find_forward: Option<KeybindingsSpec>,
/// Motion: find the previous character on the current line (`F`).
pub motion_find_backward: Option<KeybindingsSpec>,
/// Motion: stop before the next character on the current line (`t`).
pub motion_till_forward: Option<KeybindingsSpec>,
/// Motion: stop after the previous character on the current line (`T`).
pub motion_till_backward: Option<KeybindingsSpec>,
/// Select an inner text object after an operator.
pub select_inner_text_object: Option<KeybindingsSpec>,
/// Select an around text object after an operator.