-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Helix Support (WIP) #19175
base: main
Are you sure you want to change the base?
Conversation
We require contributors to sign our Contributor License Agreement, and we don't have @wmstack on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
I am trying to understand how to implement the Helix signature motions in normal mode. I think the most helpful piece of the code is this visual motion piece, which I am putting here to study: Lines 119 to 197 in ec5d6e9
This in turn runs the Lines 199 to 305 in ec5d6e9
|
@cla-bot check |
The cla-bot has been summoned, and re-checked this pull request! |
Okay, I have implemented some semblance of Helix's |
Thanks for this! I'm struggling to decide what to do with Helix: there's clearly a lot of demand for it, but I know that there's enough to do in vim to keep me busy forever :D. As mentioned before, I think it'd be ok to merge a WIP helix mode in such a way that it's not impacting the overall user/developer experience, and I think this PR is a reasonable approach (#17575 goes a completely different way, and I also think that is reasonable - but this seems less intrusive somehow). Back to your questions: One thing that causes problems in vim (and probably will in helix too) is that a collapsed selection in zed is represented as the position before the character that the block cursor is under; whereas an expanded selection spans from before the first character to after the last. In vim you can only be in normal mode when selections are collapsed, but in helix, normal mode may have expanded or collapsed selections. Lines 142 to 193 in 56163b1
If you'd like to pair on this, please book time here: https://calendly.com/conradirwin/pairing (@maan2003 let me know if you want to join too, and I'll send you the link). |
I use and like Helix a lot, but part of its allure is the opinionated and constrained package. Dumping some Helix concepts into Zed doesn't really make it Helix and potentially adds a lot of expectations and confusion in terms of maintenance and feature parity. I wonder if it's possible to codify the name of the feature being added for clarity and to limit expectations. From what I can tell the desire is mostly for the object-verb grammar as opposed to verb-object. Object-verb is not even a Helix thing; it's lifted from Kakoune. At any rate, I wonder if this could be slotted into the existing vim settings with something like: "vim_mode": true,
"vim": {
"grammar": "helix (or kakoune)" // default "vim" (or vi if I'm being so pedantic :))
}, or "vim_mode": true,
"vim": {
"grammar": "object_verb" // default "verb_object"
}, If that doesn't prove to be enough then perhaps in the future a more full-blown Helix/Kak extension similar to VSCode's Dance emerges down the road. |
Okay word movements W.E.and.B.motions.mov |
Nice! Before I merge this I'd like to talk things through with you. Also, I think we should:
|
Apologies for the delay. When I first submitted the pull request, I had upcoming university exams that required my focus. After completing those exams, I found it challenging to regain the motivation to continue with this. Thanks for your patience. I added a test for next word start, and I discovered that it wasn't actually working as intended for the word before a new line it selected the newline character too. So I fixed that. Also, I am aware of a problem where when moving one character right when there is a selection, a character is skipped (as can be seen in the video above). This probably happens for the reason you mentioned before. However, as far as I am aware, the word motions are all correct, but I haven't tested them extensively and there are a number of edges cases. I have booked a meeting as I am interested to discuss the next steps. I feel like the issue should be open until a significant number of helix commands are functional. |
Closes #4642