mirror of
https://github.com/openai/codex.git
synced 2026-10-21 17:48:44 +00:00
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:
committed by
copyberry
parent
25a6e316c8
commit
98ee29c7cd
@@ -136,6 +136,10 @@ pub(super) const KEYMAP_ACTIONS: &[KeymapActionDescriptor] = &[
|
||||
action("vim_normal", "Vim normal", "move_word_end", "Move to the end of the current or next word."),
|
||||
action("vim_normal", "Vim normal", "move_line_start", "Move to the start of the line."),
|
||||
action("vim_normal", "Vim normal", "move_line_end", "Move to the end of the line."),
|
||||
action("vim_normal", "Vim normal", "find_forward", "Find the next character on the current line."),
|
||||
action("vim_normal", "Vim normal", "find_backward", "Find the previous character on the current line."),
|
||||
action("vim_normal", "Vim normal", "till_forward", "Stop before the next character on the current line."),
|
||||
action("vim_normal", "Vim normal", "till_backward", "Stop after the previous character on the current line."),
|
||||
action("vim_normal", "Vim normal", "delete_char", "Delete the character under the cursor."),
|
||||
action("vim_normal", "Vim normal", "replace_char", "Replace the character under the cursor."),
|
||||
action("vim_normal", "Vim normal", "repeat_last_change", "Repeat the last complete edit."),
|
||||
@@ -159,6 +163,10 @@ pub(super) const KEYMAP_ACTIONS: &[KeymapActionDescriptor] = &[
|
||||
action("vim_operator", "Vim operator", "motion_word_end", "Operator motion to end of word."),
|
||||
action("vim_operator", "Vim operator", "motion_line_start", "Operator motion to line start."),
|
||||
action("vim_operator", "Vim operator", "motion_line_end", "Operator motion to line end."),
|
||||
action("vim_operator", "Vim operator", "motion_find_forward", "Operator motion to the next character on the current line."),
|
||||
action("vim_operator", "Vim operator", "motion_find_backward", "Operator motion to the previous character on the current line."),
|
||||
action("vim_operator", "Vim operator", "motion_till_forward", "Stop before the next character on the current line."),
|
||||
action("vim_operator", "Vim operator", "motion_till_backward", "Stop after the previous character on the current line."),
|
||||
action("vim_operator", "Vim operator", "select_inner_text_object", "Select an inner text object."),
|
||||
action("vim_operator", "Vim operator", "select_around_text_object", "Select an around text object."),
|
||||
action("vim_operator", "Vim operator", "cancel", "Cancel the pending operator."),
|
||||
@@ -290,6 +298,10 @@ pub(super) fn binding_slot<'a>(
|
||||
("vim_normal", "move_word_end") => Some(&mut keymap.vim_normal.move_word_end),
|
||||
("vim_normal", "move_line_start") => Some(&mut keymap.vim_normal.move_line_start),
|
||||
("vim_normal", "move_line_end") => Some(&mut keymap.vim_normal.move_line_end),
|
||||
("vim_normal", "find_forward") => Some(&mut keymap.vim_normal.find_forward),
|
||||
("vim_normal", "find_backward") => Some(&mut keymap.vim_normal.find_backward),
|
||||
("vim_normal", "till_forward") => Some(&mut keymap.vim_normal.till_forward),
|
||||
("vim_normal", "till_backward") => Some(&mut keymap.vim_normal.till_backward),
|
||||
("vim_normal", "delete_char") => Some(&mut keymap.vim_normal.delete_char),
|
||||
("vim_normal", "replace_char") => Some(&mut keymap.vim_normal.replace_char),
|
||||
("vim_normal", "repeat_last_change") => Some(&mut keymap.vim_normal.repeat_last_change),
|
||||
@@ -313,6 +325,10 @@ pub(super) fn binding_slot<'a>(
|
||||
("vim_operator", "motion_word_end") => Some(&mut keymap.vim_operator.motion_word_end),
|
||||
("vim_operator", "motion_line_start") => Some(&mut keymap.vim_operator.motion_line_start),
|
||||
("vim_operator", "motion_line_end") => Some(&mut keymap.vim_operator.motion_line_end),
|
||||
("vim_operator", "motion_find_forward") => Some(&mut keymap.vim_operator.motion_find_forward),
|
||||
("vim_operator", "motion_find_backward") => Some(&mut keymap.vim_operator.motion_find_backward),
|
||||
("vim_operator", "motion_till_forward") => Some(&mut keymap.vim_operator.motion_till_forward),
|
||||
("vim_operator", "motion_till_backward") => Some(&mut keymap.vim_operator.motion_till_backward),
|
||||
("vim_operator", "select_inner_text_object") => Some(&mut keymap.vim_operator.select_inner_text_object),
|
||||
("vim_operator", "select_around_text_object") => Some(&mut keymap.vim_operator.select_around_text_object),
|
||||
("vim_operator", "cancel") => Some(&mut keymap.vim_operator.cancel),
|
||||
|
||||
Reference in New Issue
Block a user