diff options
-rw-r--r-- | alacritty.yml | 4 | ||||
-rw-r--r-- | alacritty/src/config/bindings.rs | 8 | ||||
-rw-r--r-- | alacritty/src/input.rs | 20 |
3 files changed, 15 insertions, 17 deletions
diff --git a/alacritty.yml b/alacritty.yml index 5a14a417..63d8f6c7 100644 --- a/alacritty.yml +++ b/alacritty.yml @@ -534,8 +534,8 @@ # - ToggleSemanticSelection # - SearchNext # - SearchPrevious -# - SearchEndNext -# - SearchEndPrevious +# - SearchStart +# - SearchEnd # # (macOS only): # - ToggleSimpleFullscreen: Enters fullscreen without occupying another space diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs index 81a46d66..77521318 100644 --- a/alacritty/src/config/bindings.rs +++ b/alacritty/src/config/bindings.rs @@ -218,10 +218,10 @@ pub enum ViAction { SearchNext, /// Jump to the beginning of the previous match. SearchPrevious, - /// Jump to the end of the next match. - SearchEndNext, - /// Jump to the end of the previous match. - SearchEndPrevious, + /// Jump to the next start of a match to the left of the origin. + SearchStart, + /// Jump to the next end of a match to the right of the origin. + SearchEnd, /// Launch the URL below the vi mode cursor. Open, } diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index 2d865990..58ca42cb 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -208,20 +208,18 @@ impl<T: EventListener> Execute<T> for Action { ctx.terminal_mut().vi_goto_point(*regex_match.start()); } }, - Action::ViAction(ViAction::SearchEndNext) => { - let origin = ctx.terminal().visible_to_buffer(ctx.terminal().vi_mode_cursor.point); - let direction = ctx.search_direction(); - - let regex_match = ctx.terminal().search_next(origin, direction, Side::Right, None); + Action::ViAction(ViAction::SearchStart) => { + let terminal = ctx.terminal(); + let origin = terminal.visible_to_buffer(ctx.terminal().vi_mode_cursor.point); + let regex_match = terminal.search_next(origin, Direction::Left, Side::Left, None); if let Some(regex_match) = regex_match { - ctx.terminal_mut().vi_goto_point(*regex_match.end()); + ctx.terminal_mut().vi_goto_point(*regex_match.start()); } }, - Action::ViAction(ViAction::SearchEndPrevious) => { - let origin = ctx.terminal().visible_to_buffer(ctx.terminal().vi_mode_cursor.point); - let direction = ctx.search_direction().opposite(); - - let regex_match = ctx.terminal().search_next(origin, direction, Side::Right, None); + Action::ViAction(ViAction::SearchEnd) => { + let terminal = ctx.terminal(); + let origin = terminal.visible_to_buffer(ctx.terminal().vi_mode_cursor.point); + let regex_match = terminal.search_next(origin, Direction::Right, Side::Right, None); if let Some(regex_match) = regex_match { ctx.terminal_mut().vi_goto_point(*regex_match.end()); } |