zed icon indicating copy to clipboard operation
zed copied to clipboard

wip: Add Helix keybindings

Open maan2003 opened this issue 1 year ago • 2 comments

Release Notes:

  • N/A

very wip, will cleanup eventually

to activate helix mode:

  • add "helix_mode": true in settings
  • open zed
  • press i<esc> (insert mode -> escape) to enter helix mode

you will see -- HELIX -- in status bar

maan2003 avatar Jul 03 '24 08:07 maan2003

Thanks for sending this!

Let me know when this is ready for me to take more of a look and I will. For now I'll assume you're working on getting ti to a point we can merge it behind a compile flag.

ConradIrwin avatar Jul 10 '24 17:07 ConradIrwin

Hello, If there is any way to help I think a lot of person would be glad to. Currently there's a keymap to match the binding but this very far from the actual helix motion. https://github.com/zed-industries/zed/issues/4642#issuecomment-2227421718

noahfraiture avatar Jul 14 '24 18:07 noahfraiture

I am still working on this, but only over weekends.

latest round of improvements include a correctly working xd and xc :)

(which are the really tricky)

@ConradIrwin: should I try to get it merged in extermely broken state under a feature flag? (most of bindings have a stroke on seeing EOF or soft warp)

maan2003 avatar Jul 15 '24 07:07 maan2003

@maan2003 I think that makes sense, yes; then people can help more easily by sending PRs to main instead of your branch.

When you think this is ready for me to take a pass, let me know.

ConradIrwin avatar Jul 15 '24 14:07 ConradIrwin

Would love to have this in, and then subsequently improved further, rather than a giant PR. Out of curiosity, what is missing?

sytherax avatar Jul 19 '24 06:07 sytherax

I am waiting this feature every day

1925381584 avatar Jul 20 '24 14:07 1925381584

Hey! Just was thinking about start to implement helix/kakoune mode for zed and found this one. I'm just curious why this mode is implemented as part of vim_mode crate instead of separate one?

Idea is to start changing vim_mode = true to modal_mode = "vim|helix", copy vim_mode crate as separate helix_mode and make changes there. Eventually extract common stuff to modal_mode.

What do you think?

fazibear avatar Jul 23 '24 09:07 fazibear

@fazibear mostly based on https://github.com/zed-industries/zed/pull/11130#issuecomment-2084206242 and other discussions we've had.

Not super tied to having it in the vim crate.

The current goal is to merge the basics behind a rust feature flag so we can start improving it in tree.

ConradIrwin avatar Jul 23 '24 21:07 ConradIrwin

I'm just curious why this mode is implemented as part of vim_mode crate instead of separate one?

because spliting crates is just an optimization to save compile time :)

Yes it should be a separate crate in future when it is ready, but I didn't want to think about circular deps.


I am waiting this feature every day

me too

maan2003 avatar Jul 24 '24 02:07 maan2003

I'm just curious why this mode is implemented as part of vim_mode crate instead of separate one?

because spliting crates is just an optimization to save compile time :)

Yes it should be a separate crate in future when it is ready, but I didn't want to think about circular deps.

I am waiting this feature every day

me too

An Idea would be to split it into 3 crates:

  • modal
  • vim
  • helix

modal contains code thats shared by both (and potentially future) vim and helix modal modes. This should also fix circular deps.

Suya1671 avatar Jul 24 '24 05:07 Suya1671

I am waiting this feature every day

me too.

linuxmobile avatar Jul 29 '24 23:07 linuxmobile

It would maybe good to stop pushing the author since he said he can only works weekend, give him time to cook

noahfraiture avatar Jul 30 '24 15:07 noahfraiture

I am going to close this for now because I am used to vim keybindings.

maan2003 avatar Aug 11 '24 11:08 maan2003

I am going to close this for now because I am used to vim keybindings.

your reason sucks

ghost avatar Aug 11 '24 11:08 ghost

I am going to close this for now because I am used to vim keybindings.

your reason sucks

Please be respectful. Developers can choose what they want to work on

Guekka avatar Aug 11 '24 11:08 Guekka

your reason sucks

agreed that reason sucks for lot of people.

You are free to continue working on helix keybindings from where I stopped.

I would love to use helix bindings in future. But implementing helix bindings is lot of work.

maan2003 avatar Aug 11 '24 11:08 maan2003

This is unproductive, and frankly a waste of everyone's time and energy - especially for the watchers who get pinged everytime. Please refrain from commenting unless you have something of substance to add.

OP has made it clear that it's a lot of work that they can't commit to. At this point, I think a better solution would be to urge helix core devs to either a) invest more effort in this PR or b) Perhaps setup a bounty for this feature.

I know this is disappointing - I myself have been waiting for this feature for quite a while - but harassing the OP gets us nowhere. Please be civil.

neel04 avatar Aug 11 '24 11:08 neel04

@maan2003 Hello, is it possible to know where you were and what is left to do ? It would be easier to continue this PR if we knew what we could do. Also I think that it would be great to have a merge quickly to open to contributions

noahfraiture avatar Aug 21 '24 00:08 noahfraiture

👋 Thanks for all your work on this @maan2003!

I've talked with a few people about building Helix support into Zed. Realistically I don't have the time to do this myself, but I am happy for anyone to work on this.

We've tried two different approaches so far:

  • A new helix crate that probably depends on the vim crate, but adds more stuff, and maintains the mode separately.
  • Updating the vim crate to support helix too depending on a config flag.

It's not yet clear which one is better (I lean towards including it in the vim crate because it seems like much of the state management is the same as vim, BUT, most of the actions/motions are different); so happy for whoever picks this up next to choose.

In terms of first steps, I'd love to get to the point that we have a basic set of helix features (maybe just a setting and the ability to toggle between normal/insert mode) merged and disabled behind a compile time flag. That will let people who want to use it and improve it do so. Once we reach a point where we have middling-to-good helix support (i.e. most motions working kind of right) we can remove the flag. I think this is too big of a feature to try and land in one PR.

Once Zed's extension APIs are good enough to implement helix, it would make more sense to be an extension, but that is likely very very far away, so I think if we want this in the next year or two, we should build it in.

I'm happy to pair with anyone who's interested in making progress on this: https://calendly.com/conradirwin/pairing.

ConradIrwin avatar Aug 21 '24 03:08 ConradIrwin

@noahfraiture I am happy to pair, we can coordinate on discord (@mx42).

maan2003 avatar Aug 21 '24 11:08 maan2003

Hello, I'm sorry for this but I won't be able to work on this project a lot. I already took contact with maan2003 but there's more work than I thought and I have a personal unforeseen event that takes up a lot of my time.

Instead of making you all wait for weeks, I prefer to annonce that I won't make a new PR. I would be happy to contribute once a first PR have been merge tho

noahfraiture avatar Sep 02 '24 09:09 noahfraiture

superseded by https://github.com/zed-industries/zed/pull/17575

maan2003 avatar Sep 08 '24 21:09 maan2003

superseded by #17575

not just a maan

but a heero!

luccahuguet avatar Sep 10 '24 20:09 luccahuguet