Skip to content
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

Helix keymap #4642

Open
humb1t opened this issue Jul 4, 2023 · 51 comments · Fixed by #19175
Open

Helix keymap #4642

humb1t opened this issue Jul 4, 2023 · 51 comments · Fixed by #19175
Labels
enhancement [core label] keymap / key binding Feedback for keyboard shortcuts, key mapping, etc

Comments

@humb1t
Copy link

humb1t commented Jul 4, 2023

I know it can be tricky, but the only reason preventing me from day to day use of zed is Helix with their beautiful system based on keys without mouse, multiple selections and other features.

Will be great to support that and maybe I will try to research possible ways to do so:
https://docs.helix-editor.com/keymap.html

@JosephTLyons JosephTLyons transferred this issue from zed-industries/keymaps Jul 19, 2023
@JosephTLyons JosephTLyons added enhancement [core label] keymap / key binding Feedback for keyboard shortcuts, key mapping, etc labels Jul 19, 2023
@ConradIrwin ConradIrwin mentioned this issue Sep 27, 2023
1 task
@3210jr
Copy link

3210jr commented Jan 1, 2024

Zed is pretty awesome and support for the helix bindings would be nice. Can we do a bounty for someone from the community/core to get this running? I am not so skilled myself 😀.

I can do $100 for anything helix bindings related.

@JosephTLyons
Copy link
Collaborator

JosephTLyons commented Jan 1, 2024

Zed is pretty awesome and support for the helix bindings would be nice. Can we do a bounty for someone from the community/core to get this running? I am not so skilled myself 😀.

I can do $100 for anything helix bindings related.

Hey @3210jr - this is an extremely nice gesture; if I had to guess, I think the biggest blocker isn't that someone doesn't want to do it, it is probably more that at the moment, contributing to keymaps is a bit awkward at the moment. We don't have documentation on what all the contexts are, the source code of Zed is closed (not for much longer 🥳), the keymaps repository is simply a mirror of the internal files in Zed, so changes made to either end have to be manually copied and pasted between repos. It's all just very awkward and sort of hard to do. Someone could still do it for sure, but the process is kind of ugly and not user friendly. I imagine that once we are open source, and once we move keymaps into some sort of user-accessible directory, or plugin system, that we will have a lot more fixes to existing keymaps, and new keymaps in general, coming in.

@JosephTLyons JosephTLyons transferred this issue from zed-industries/community Jan 24, 2024
@nyabinary
Copy link

Zed + Helix would be extremely nice :3

@alphabitserial
Copy link

I would absolutely love to have this. I've been using Helix as my main editor for several months. Having a GUI with the same ergonomics would be fantastic.

@seanchen1991
Copy link

Now that the repository has been open-sourced, what would be a rough outline of adding Helix keymap support? 🙂

@danriedl
Copy link

I would absolutely love to have this. I've been using Helix as my main editor for several months. Having a GUI with the same ergonomics would be fantastic.

I'm in the same spot but have to say, that i'll stick to helix itself.
Tried helix - binding in vscode but still it's not the same experience.

@ascarter
Copy link

@JosephTLyons I think the request here would be to do a modal keymap that is Selection-Action instead of Action-Selection. There are multiple modal editors now (which Helix is probably one of the best) that use this model. If Zed could support it, would be really cool to see.

Another thought long term - NeoVim crew embedded their engine into VS Code. You can run the editor window using NeoVim but within the rest of VS Code. Would be very interesting for Zed to do something like this where another terminal type engine could power the editor. Maybe a chance to get the best of both worlds.

@andreweades
Copy link

I would like to look into this as I use Helix in preference to vim when I can. But how to do it? Is it a complete new mode? Or is it a key-binding hack on vim-mode?

@clo4
Copy link
Contributor

clo4 commented Feb 7, 2024

@andreweades You'd have to introduce a new helix crate to implement some of the actions, and create a new keymap to use the actions. It's distinct enough from Vim that it would probably warrant a new editing mode, because selection->action really is a distinct paradigm from action->motion. But it might be worth taking a step back and instead of just copying the Helix keymap thinking about what it might look like to design a selection->action keymap just for Zed. Most of the infrastructure is already there! Would it feel different from Kakoune and Helix given it's in a GUI editor?

@wmstack
Copy link
Contributor

wmstack commented Feb 16, 2024

Also I do like the helix bindings but I don't like to retain the selection when returning using insert mode or append mode. I have this mapped in helix a = ['append_mode', 'collapse_selection'] and i = ['insert_mode', 'collapse_selection']. I hope similar bindings can be supported in Zed.

Also vim doesn't really allow you to select the newline character (or the emptiness at the end of the buffer). Helix does. I have a hard time differentiating a whitespace from a newline in helix so I hope the cursor changes colour or something when it is on a newline character.

@WarrenAdams8

This comment was marked as spam.

@andreweades
Copy link

@clo4 Good point. I use a custom Helix keymap as some of my muscle memory from VIM does not translate well. I try to limit the amount of mousing as after 30+ years of mousing I have RSI in my shoulder so I like editors that have VIM and now Helix keys. I think selection->action makes a lot of sense so I would love to see it in Zed at some point and would not mind contributing when I have time.

@wmstack
Copy link
Contributor

wmstack commented Mar 3, 2024

@JosephTLyons I wonder why this is not in the top ranking issues? It has more votes than a lot of the ones I see there. Is it because it doesn't neatly fit into one of the categories? Maybe it should be in the vim section.

@JosephTLyons
Copy link
Collaborator

@JosephTLyons I wonder why this is not in the top ranking issues? It has more votes than a lot of the ones I see there. Is it because it doesn't neatly fit into one of the categories? Maybe it should be in the vim section.

This would only be included on the top-ranking issues report if it had more likes than the item at the bottom of the enhancement section (Git in-line blame indicators - 81 👍).

ConradIrwin pushed a commit that referenced this issue Mar 21, 2024
This PR is a bit of a shot in the dark. I'm not sure if this will be
acceptable and I understand if it gets rejected.

I've been trying to integrate Zed as my daily driver and the key
bindings have been a major hurdle for me. Mostly due to the
windows/linux keybindings being messed up, but also me wanting to have
more chained key bindings similar to helix or common in custom neovim
configurations.

I think having a `None` base keymap would allow someone to more easily
implement a new base keymap (#4642) and would make my daily use of Zed a
little nicer 😅.

Also I am aware that there would need to be a little more work done in
this PR for the other base keymaps such as 'atom' since they assume the
'default' (vscode) base keymaps are loaded. I'm happy to do that work if
a 'none' base keymap is acceptable.

Release Notes:

- Added ability to specify no base keymap which allows for full
keybinding customization
pjlast pushed a commit to pjlast/zed that referenced this issue Mar 26, 2024
This PR is a bit of a shot in the dark. I'm not sure if this will be
acceptable and I understand if it gets rejected.

I've been trying to integrate Zed as my daily driver and the key
bindings have been a major hurdle for me. Mostly due to the
windows/linux keybindings being messed up, but also me wanting to have
more chained key bindings similar to helix or common in custom neovim
configurations.

I think having a `None` base keymap would allow someone to more easily
implement a new base keymap (zed-industries#4642) and would make my daily use of Zed a
little nicer 😅.

Also I am aware that there would need to be a little more work done in
this PR for the other base keymaps such as 'atom' since they assume the
'default' (vscode) base keymaps are loaded. I'm happy to do that work if
a 'none' base keymap is acceptable.

Release Notes:

- Added ability to specify no base keymap which allows for full
keybinding customization
@blufony blufony mentioned this issue Apr 28, 2024
6 tasks
@zoedsoupe
Copy link

i would love to have helix support inside zed 💜

how i could contribute to achieve this new crate? i'm not the very best rust developer but i think i can mimic the vim crate somehow and do some tweaks to achieve selection->action mode.

@ConradIrwin
Copy link
Member

@zoedsoupe There's some work at #11130, but the original author is unable to keep working on it. If you'd like to start working on that branch that would be very appreciated!

We decided to stay in the same crate as vim for now (because that way we can re-use all the mode tracking, registers, marks, test support, etc.). once we have something more close to usable we can revisit that decision if necessary.

@Suya1671
Copy link

Suya1671 commented Jun 8, 2024

I wonder how feasible it would be to embed the helix core into zed and use that for not just helix emulation but just straight up full helix support. Similar to how neovide does it for nvim

@sameoldlab
Copy link

AFAIK it is not possible now because helix does not have a splitting feature helix-editor/helix#312 @Suyashtnt. Based on the issue's title, Kakoune does have a client-server model? If that worked it'd also mean slightly different keymaps, and no support for the Helix -> Zed windows user.

But it might be worth taking a step back and instead of just copying the Helix keymap thinking about what it might look like to design a selection->action keymap just for Zed. Most of the infrastructure is already there! Would it feel different from Kakoune and Helix given it's in a GUI editor?

@hamzahmalik101
Copy link

Does anyone know of a way to rebind movement in zed? Here's what I have in helix:

[keys.normal]
# Replacing hjkl keybinds
n = "move_char_left"
o = "move_char_right"
i = "move_line_up"
e = "move_line_down"

@ConradIrwin
Copy link
Member

@hamzahmalik101 https://zed.dev/docs/key-bindings and https://zed.dev/docs/vim should get you started

@nabby27
Copy link

nabby27 commented Aug 30, 2024

Zed is pretty awesome and support for the helix bindings would be nice. Can we do a bounty for someone from the community/core to get this running? I am not so skilled myself 😀.

I can do $100 for anything helix bindings related.

I feel the same way, I think Zed is fantastic and I would like to see this issue resolved! I just created a $100 bounty on Opire, if anyone wants to join and add more money to the bounty that would be great. I love the project and this way I can contribute my two cents.

@alphabitserial
Copy link

Does anyone know of a way to rebind movement in zed? Here's what I have in helix:

[keys.normal]
# Replacing hjkl keybinds
n = "move_char_left"
o = "move_char_right"
i = "move_line_up"
e = "move_line_down"

Wow, another Workman layout user! Small world!

@thiagomajesk
Copy link

I don't know what the current state of this issue is but I'm particularly interested in having a mechanism where you can configure your own set of keybindings for modal editing (be it Vim, Helix, Kakoune, or something else).

Maybe this belongs to an extension, but having native support would be a killer feature. Don't get me wrong, I think Helix modal editing is great, but I wish that some of the default keybindings were more consistent (there's a huge thread about keymaps on the Helix repository discussing some of the decisions and they don't seem inclined to change any of it).

If we get that and a TUI equivalent interface like in: #7493 it would be perfect 😚👌

@oliverpool
Copy link
Contributor

a mechanism where you can configure your own set of keybindings for modal editing

@thiagomajesk did you have a look at @noahfraiture keymap.json? https://github.com/noahfraiture/zed-helix

It should help get you started.

@thiagomajesk
Copy link

thiagomajesk commented Sep 18, 2024

@oliverpool, does this actually work? How can I test it? (It looks like I missed some Zed updates 😅). From what I'm reading this is built on top of the native Vim support which might be a little limiting, but it's a good start.

I think I would still love to see Zed support modal editing in a generic way and then build both Vim and Helix keybindings on top of native Zed commands. Do you know if this is something maintainers are looking into?

@noahfraiture
Copy link

@thiagomajesk It's a simple configuration file that you need to add to your setup. However, to be honest, it isn't very effective due to the differences between Vim and Helix motion.

Several people want Helix motion to be implemented, and only @maan2003 has done significant work to make it happen. There has been a new PR #17575 because the previous one was too extensive for a single person to handle, and no one had the courage to continue it.

This new PR should be merged soon, and then everyone will be free to make improvements, as it doesn’t aim to be a complete integration of Helix into Zed.

@jerabaul29
Copy link

One thing that would be very useful / helpful is, if possible, to support the full range of commands from helix - not just the text navigation and editing, but also stuff like the "goto mode", "window mode", "space mode", etc, so it is possible to fully use Zed including menus, different tabs and panes, only with the keyboard. But I understand this may be a big ask though :) .

@TeriyakiBomb
Copy link

I’ve fallen for helix bindings, but there are still things missing from helix and I prefer gui apps. This would probably be enough to prompt me to move to Zed.

@hajarrashidi
Copy link

I have paused my use of Zed because I need to improve my Helix skills. I hope there will soon be keybindings for Helix in Zed

@haras-unicorn
Copy link

thank you for the initial support for helix! :)

i read a bit through this PR and it adds the basic helix motions through a somewhat awkward keymap to enter helix normal mode

not sure if this should be closed yet though because coming from helix people will want way more than just that

@luccahuguet
Copy link

thank you for the initial support for helix! :)

i read a bit through this PR and it adds the basic helix motions through a somewhat awkward keymap to enter helix normal mode

not sure if this should be closed yet though because coming from helix people will want way more than just that

I believe this calls for a follow-up issue, where we can follow future improvements

is there one already?

leroycep added a commit to leroycep/zed that referenced this issue Dec 4, 2024
leroycep added a commit to leroycep/zed that referenced this issue Dec 6, 2024
@leroycep
Copy link
Contributor

leroycep commented Dec 6, 2024

Having looked at the vim mode implementation a bit, I'm wondering if it would make more sense to just make a completely separate helix mode. While helix and vim are both modal editors, vim is more distant from non-modal editors like zed because of it's verb-object structure.

In helix, much like in zed, the multi-cursor model is fundamentally how you interact with the buffer. You make list of selections, then perform a command like delete or indent on that list of selections.

Some other differences I've noticed:

  • vim clamps the cursor to a line; helix will wrap onto the next line (like zed does)
  • vim has two separate delete commands, 'd' and 'x'. 'd' requires an object, and 'x' just deletes a character. Helix only has 'd', which is identical to pressing the delete key in zed, except that it copies the deleted text into the register "
  • As far as I know, helix doesn't have an operator stack? Correct me if I'm wrong.
  • I don't think helix needs to track the previous mode it was in, or worry about temporary modes in general? Most of the other modes drop back into normal mode, and "space" mode and related act more like a command palette than anything.

Now of course there are some similarities between vim and helix:

  • You can use . to "replay" some inserted text
  • Helix and vim both have the concept of registers
  • Pressing : in normal mode will let you enter a command
  • Pressing / in normal mode will enter search mode

But honestly I think helix's keymap is closer to zed's than it is to vim's.

ConradIrwin pushed a commit that referenced this issue Dec 6, 2024
Related issue: #4642

Release-Notes:

* N/A
@ConradIrwin ConradIrwin reopened this Dec 16, 2024
@redactedontop
Copy link

Hallo!

Sorry to bother, but any updates?
I'm in love with helix-style keybinds, and I wanna make my whole editor (and life!) use them. A separate helix mode would be definitely prefered.

Thanks,
Alex <3

@redactedontop
Copy link

Actually, I believe that Helix could be in the same mode as vim, but kakoune bindings would benefit for a different mode (as it doesn't have a visual mode).
Or maybe helix would be in the kakoune mode.

@jabcross
Copy link

Wouldn't the ideal thing be figuring out a way to make the keybinding and macro system flexible enough to replicate any of the editors through configuration alone? Most modal editor users customize their keybindings anyways.

@fingersmurphy
Copy link

fingersmurphy commented Jan 15, 2025 via email

@redactedontop
Copy link

Fuck it. I'm doing it.

@atahrijouti
Copy link

Fuck it. I'm doing it.

Doing what? Don't keep us in suspense!

@fingersmurphy
Copy link

fingersmurphy commented Jan 23, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement [core label] keymap / key binding Feedback for keyboard shortcuts, key mapping, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.