Skip to content

Conversation

@HactarCE
Copy link
Contributor

@HactarCE HactarCE commented Oct 30, 2025

Closes #41125
Closes #41164

This PR removes the out-of-band tracking of whether selection ranges should be compacted to the start of the range. That's useful for things like SelectNextMatch in vim, but it turns out not to be as universal when using vim mode as the original authors had thought, so we'd have to do silly hacks like turning that setting on and off between certain motions to get the correct behavior both for vim and helix modes.

Now you have to explicitly pass a collapse flag into the helpers having to do with buffer search selection matching, and we've migrated the relevant APIs to use that.

We also discovered a false positive in the helix tests around s used without a selection. In helix this doesn't do anything, but because of the semantics of our "search selected lines" flag, in zed it simply acts like /. We've disabled this test for now because the more faithful behavior doesn't seem necessarily more useful.

Release Notes:

  • Fixed SwitchToHelixNormalMode to keep selection when hitting escape from select mode, and bound it to escape in helix select mode by default.
  • Improved the behavior of vim::MoveToNextMatch and search::SelectNextMatch (as well as their previous counterparts) when using helix mode. When enabled, the latter now creates multiple selections using multicursor, unlike in vim where it simply deselects the current match and selects the next one.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Oct 30, 2025
@HactarCE HactarCE enabled auto-merge (squash) October 30, 2025 15:55
HactarCE and others added 3 commits October 30, 2025 18:08
Co-authored-by: Julia Ryan <juliaryan3.14@gmail.com>
Co-authored-by: Julia Ryan <juliaryan3.14@gmail.com>
also fixed a bunch of helix mode things

Co-authored-by: Julia Ryan <juliaryan3.14@gmail.com>
@P1n3appl3 P1n3appl3 force-pushed the fix-helix-mode-deselect-on-mode-switch branch from 10bd5fb to c775178 Compare October 31, 2025 01:09
@P1n3appl3 P1n3appl3 changed the title Keep selection in SwitchToHelixNormalMode Helix mode selection improvements Oct 31, 2025
@P1n3appl3 P1n3appl3 changed the title Helix mode selection improvements Helix mode search and selection improvements Oct 31, 2025
@HactarCE HactarCE merged commit eab06eb into main Oct 31, 2025
40 of 42 checks passed
@HactarCE HactarCE deleted the fix-helix-mode-deselect-on-mode-switch branch October 31, 2025 01:53
tomatitito pushed a commit to tomatitito/zed that referenced this pull request Nov 7, 2025
Closes zed-industries#41125

Release Notes:

- Fixed `SwitchToHelixNormalMode` to keep selection
- Added default keybinds for `SwitchToHelixNormalMode` when in Helix
mode
dinocosta added a commit to shaik-zeeshan/zed that referenced this pull request Nov 17, 2025
Revert the original changes done to fix the issue with `g d` in vim mode
updating the mode to Visual.

After looking into this it appears this was accidentally changed in
zed-industries#41583 with the removal of the
`collapse_matches` field from the `Editor`, which would be provided to
the `range_for_match` method and, in the case where vim mode was
enabled, it was `true`, avoiding the change to visual mode when jumping
to definition.

This commit updates the `Editor.navigate_to_hover_links` method in order
to check if vim mode is enabled, in which case it now collapses the
range, otherwise it won't, returning to the previous behavior.
ConradIrwin added a commit that referenced this pull request Nov 17, 2025
ConradIrwin added a commit that referenced this pull request Nov 17, 2025
Closes #ISSUE

Release Notes:

- Fixes vim "go to definition" making a selection
github-actions bot pushed a commit that referenced this pull request Nov 17, 2025
Closes #ISSUE

Release Notes:

- Fixes vim "go to definition" making a selection
github-actions bot pushed a commit that referenced this pull request Nov 17, 2025
Closes #ISSUE

Release Notes:

- Fixes vim "go to definition" making a selection
zed-zippy bot added a commit that referenced this pull request Nov 17, 2025
… (cherry-pick to preview) (#42903)

Cherry-pick of #42892 to preview

----
Closes #ISSUE

Release Notes:

- Fixes vim "go to definition" making a selection

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
HactarCE added a commit that referenced this pull request Nov 19, 2025
This PR redoes the desired behavior changes of #41583 (reverted in
#42892) but less invasively

Closes #41125
Closes #41164

Release Notes:

- N/A

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
mikayla-maki pushed a commit that referenced this pull request Nov 20, 2025
This PR redoes the desired behavior changes of #41583 (reverted in
#42892) but less invasively

Closes #41125
Closes #41164

Release Notes:

- N/A

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement community champion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Helix mode: SelectPreviousMatch doesn't select/extend Helix mode: don't deselect on mode switch

2 participants