diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 8cb3d1abf7d026..74cb60c4bbf03e 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -16207,6 +16207,7 @@ impl Editor { let Some(end) = multibuffer.buffer_point_to_anchor(&buffer, range.end, cx) else { return; }; + self.change_selections( SelectionEffects::default().nav_history(true), window, @@ -16921,7 +16922,15 @@ impl Editor { editor.update_in(cx, |editor, window, cx| { let range = target_range.to_point(target_buffer.read(cx)); - let range = editor.range_for_match(&range, false); + + // When vim mode is enabled, ensure that the range is + // collapsed to the range's start point, otherwise actions + // like jumping to a function's definition in vim mode would + // change the mode to Visual. + let range = match vim_flavor(cx) { + Some(_) => editor.range_for_match(&range, true), + None => editor.range_for_match(&range, false), + }; let range = collapse_multiline_range(range); if !split