vim: Add Helix jump-to-word support to Vim mode#55492
vim: Add Helix jump-to-word support to Vim mode#55492GoldStrikeArch wants to merge 9 commits intozed-industries:mainfrom
Conversation
|
I tested this and it works great, thank you!
I find this behavior surprising, but that might just be me. |
What you behavior you would expect? |
|
Caveat that I don't consider myself to be a vim expert. But I generally expect a motion to move the cursor to the same place whether in normal or visual mode. I'm playing around with various motions to try to find any that are different in the two modes. So far, I've only found
Otherwise, everything I've tried moves the cursor to the same position in both modes. |
I see, that makes sense. But from the practical perspective -> if you would put it to the same position as a "normal mode motion" (which is to the beginning of the word, like to the first character), is it actually what you want? Like usually you do it to delete text, etc, you would select the first letter of a word instead of the whole world (which does seem like a bad thing to me, but again I don't use Vim mode 😅 ) After some thinking:
So, I updated the branch and it should behave similar to Normal mode now |
36c493a to
5cfaa47
Compare
|
Ha, yeah those are interesting questions. I can definitely see the argument for wanting to select the word by default.
I guess that's something I wouldn't do in practice. If I want to select the current word, I would do The only other relevant data point I can think of is that when you search with All that said, I think Conrad is the maintainer of vim in Zed. He'll have a much more informed opinion than me. Thanks again for adding this, I'm really excited for it! |
|
@GoldStrikeArch Thanks for taking a pass at this! We already have sneak support, can we merge this and that? What other vim plugins exist, and what shortcuts do they use (where did you get the idea for |
I am not sure that I am following, this one and sneak are a different things
I checked out and easymotions, nvim.flash, nvim.leap and they use , |
|
Just my two cents: The afaik major jump plugins are
DifferencesThis PRshows two labels at start of word. is a "vim port" of the helix jump (or whatever its called) leapYou type flashYou normally type Screencast.From.2026-05-05.09-21-52.mp4
From the docs:
|
|
I see, so those plugins have a different mechanics and purpose. The "amp jump" is a different meaning -> you get "prepared" labels, so you can jump to any word within the current view. And this particular PR is just for Vim mode users to "get amp jump for free" because some users already tried to use it and it "kinda worked" but with Helix semantics (like the selection first) which can be somewhat easily adjusted. |
This is a good stopgap, but I think the real win would be enabling proper Flash/Leap navigation (maybe via a plugin). I'd love to see us move toward that rather than just settling for another jump-style alternative. |
IMO it is much easier to do it directly here in the |
Closes #55481
Adds Vim-mode access to the existing Helix jump-to-word overlay via
g z. We useg zbecause it is currently unassigned in Vim mode, whileg wis already used for rewrap.Most of the implementation lives in
helix.rsbecause the existing jump overlay, label generation, and Helix/Vim modal behavior are currently intertwined there. This keeps the change small and reuses the existing navigation overlay logic instead of doing a broader refactor.In Vim normal mode, jump labels behave like a cursor motion: selecting a label moves the cursor to the start of the target word without selecting it. In Vim visual mode, jump labels extend the selection like a Vim word-start motion, preserving Vim’s inclusive visual-selection behavior.
Self-Review Checklist:
Release Notes:
g z.