Add Vim search motions to the composer (#41586)

## What changed

- Add draft-local forward and backward literal search with `/` and `?`, plus
  wrapped repeat navigation with `n` and `N`.
- Support search motions after delete, change, and yank operators, while keeping
  queries separate from the draft and skipping atomic elements and partial
  grapheme matches.
- Render and edit the query in the composer footer, highlight matches, and add
  configurable `tui.keymap.vim_search` bindings to the keymap picker and schema.

## Testing

- Cover navigation, wrapping, operator composition, repeat behavior, Unicode
  graphemes, atomic elements, query editing, paste handling, and rendering.

GitOrigin-RevId: 087b080ff8fd74e48456c6b899c07ea5eed38e0c
This commit is contained in:
Benjamin Carlsson
2026-08-30 00:42:00 +00:00
committed by copyberry
parent b8c86376a2
commit 63d213884d
27 changed files with 745 additions and 42 deletions
+8
View File
@@ -154,6 +154,10 @@ pub(super) const KEYMAP_ACTIONS: &[KeymapActionDescriptor] = &[
action("vim_normal", "Vim normal", "start_yank_operator", "Begin a yank operator and wait for a motion."),
action("vim_normal", "Vim normal", "start_change_operator", "Begin a change operator and wait for a motion or text object."),
action("vim_normal", "Vim normal", "cancel_operator", "Cancel a pending Vim operator."),
action("vim_search", "Vim search", "forward", "Search forward in the active buffer."),
action("vim_search", "Vim search", "backward", "Search backward in the active buffer."),
action("vim_search", "Vim search", "next", "Repeat the accepted search."),
action("vim_search", "Vim search", "previous", "Repeat the search in the opposite direction."),
action("vim_operator", "Vim operator", "delete_line", "Repeat delete operator to delete the whole line."),
action("vim_operator", "Vim operator", "yank_line", "Repeat yank operator to yank the whole line."),
action("vim_operator", "Vim operator", "motion_left", "Operator motion left."),
@@ -320,6 +324,10 @@ pub(super) fn binding_slot<'a>(
("vim_normal", "start_yank_operator") => Some(&mut keymap.vim_normal.start_yank_operator),
("vim_normal", "start_change_operator") => Some(&mut keymap.vim_normal.start_change_operator),
("vim_normal", "cancel_operator") => Some(&mut keymap.vim_normal.cancel_operator),
("vim_search", "forward") => Some(&mut keymap.vim_search.forward),
("vim_search", "backward") => Some(&mut keymap.vim_search.backward),
("vim_search", "next") => Some(&mut keymap.vim_search.next),
("vim_search", "previous") => Some(&mut keymap.vim_search.previous),
("vim_operator", "delete_line") => Some(&mut keymap.vim_operator.delete_line),
("vim_operator", "yank_line") => Some(&mut keymap.vim_operator.yank_line),
("vim_operator", "motion_left") => Some(&mut keymap.vim_operator.motion_left),
+6 -1
View File
@@ -104,7 +104,12 @@ const KEYMAP_CONTEXT_TABS: &[KeymapContextTab] = &[
id: "vim-shortcuts",
label: "Vim",
description: "Vim normal-mode and operator shortcuts.",
contexts: &["vim_normal", "vim_operator", "vim_text_object"],
contexts: &[
"vim_normal",
"vim_operator",
"vim_search",
"vim_text_object",
],
},
KeymapContextTab {
id: "navigation-shortcuts",