-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Implement Helix Support (WIP) #19175
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
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. |
|
@ConradIrwin Well I kind of don't think that the However, really, if each function is split into two, we would have 4 functions, and both parts would really look almost identical, they would share much of the same functionality, namely skipping newline characters, and skipping the first boundary even if it lies just after the newlines. The bulk of the code, which determines where to put the new tail at, is also used to move the head forward to start testing for boundaries starting from the correct point. |
21b74e8 to
485a176
Compare
|
https://app.opire.dev/issues/01J6HJZCK02FVD4XG900FY36EE is this bounty still available or has @wmstack claimed it? |
|
@BrianTheMessiah I don't think it's been completed yet. @wmstack I am going to merge this PR, sorry for the delay, I was out last week. For anyone wanting to try the (very nascent) helix mode out, you can currently access it by creating a key-binding that does |
|
is this available on stable release? or preview release? or just by building it locally? |
from the time it was merged which is today, we didn't had any pre-release or stable release of building from main would have it. |
|
Assuming the typical Wednesday Preview Release, it will be in there. |
|
hI @wmstack I am the creator of the bounty mentioned and seeing your great work and (although the integration is not complete) the issue has already been closed and your PR has been merged, I would be more than happy to pay you the bounty for your effort, you would only need to claim it in Opire and configure your Stripe account to receive the money. |
isn't it |
|
The way I did the command was: I named it like this because |
|
Is this still in active development to reach a state of parity or almost-parity with Helix? Happy to add to the bounty if so. |
|
I tried configuring this in my settings, but still am unable to enter Helix Normal. Can anyone help? |
|
From my experimentation, this is still very work in progress, but it's promising! My config is here for those who want to use it, although it's missing many of my most common motions and actions. It's good enough for a bit of light editing. |
|
@forivall thanks! That is a great starting place. If it's useful, I immediately added this keybind for the Is there any way to make Helix normal the default instead of (vim) normal? |
|
Is there any way we can manually add some of the more complex keybindings, such as |
|
What the remainder of the work needed? |
|
Roughly:
I think a few people have said they are using helix-like keybindings, so maybe that'd be a good starting point for 2. |
Does Helix have a crate or something we can use instead for keybindings? |
Yes, here: https://github.com/helix-editor/helix/blob/master/helix-term/src/commands.rs Which is a used in https://github.com/helix-editor/helix/blob/master/helix-term/src/keymap.rs |
|
Pretty afraid Helix support is just going to rot and get eventually removed if someone doesn't step up :P. |
|
I just started testing this out in e15d20a4, and it actually feels really nice. I've never been a big helix / kakoune user, but having dabbled I get the draw. The way this is implemented actually feels like the best of both worlds. Nice work. |
if enough people want to use, we can do it. |
Helix user here, the helix bindings in Zed are a bit rough, it doesn't have default keybindings that work well with Zeds multicursors and the keymap of So it depends on what people expect from helix keybindings. Personally I'd already be pretty happy if the match thingy gets parity. |
|
i think the user expects the same use of helix, so they can just migrate to zed |
I get what you're saying, but even the Vim mode in Zed has some tiny differences and helix includes a lot out of the box, e.g. jumping to a word in the visible area of the buffer. Users chose helix for different kinds of reasons. I don't think the first thing to implement is the multicursor feature of helix ( Instead I'd recommend more keybindings that enable |
Closes #4642
Release notes: