nushell / reedline

A feature-rich line editor - powering Nushell
https://docs.rs/reedline/
MIT License
519 stars 144 forks source link

Why not a Helix Mode, to go along with Vi and Emacs? #639

Open luccahuguet opened 11 months ago

luccahuguet commented 11 months ago

I think a helix-mode would go a long way into making the reedline experience more complete, now targeting the three major modal editors.

Helix's philosophy is a bit like this (a small excerpt from their vision page on github):

Selection -> Action, not Verb -> Object. Interaction models aren't linguistics, and "selection first" lets you see what you're doing (among other benefits). We aren't playing code golf. It's more important for the keymap to be consistent and easy to memorize than it is to save a key stroke or two when editing.

helix also has multi-cursors but we could add it later.

Also important to note that helix is heavily inspired by kakoune, so this would be satisfying for that group of users too.

I added a comment in the keybinding discussion: https://github.com/nushell/reedline/issues/69#issuecomment-1736309196

and if needed a could open an issue in nushell's main repo.

fdncred commented 11 months ago

Helix mode would be fun. All it takes is someone to come in and contribute it.

luccahuguet commented 11 months ago

@fdncred Terrific!

I hope someone picks this up

crabdancing commented 8 months ago

I just wanted to say I would LOVE a Helix editing mode! I actually already find myself unconsciously trying to use Helix keybindings to edit the prompt line in Nushell when I'm tired. :P

luccahuguet commented 7 months ago

@sholderbach added some helpful comments in the draft by @savente93 on what is probably needed before a PR concerning this issue can be done: https://github.com/nushell/reedline/pull/642#issuecomment-1742705559

Just putting this here to make it easier to track. It's been a while, maybe there's been progress in some of the items..

The conditions are as follows:

I think what I would gather as a reasonable point where it makes sense to go ahead with helix mode without impacting the effort to getting the rest of the modes nice would be:

  • We have maybe reduced the number of EditCommand implementations that do essentially the same in slight variations: Move/Cut/Delete: https://github.com/nushell/reedline/blob/b1344f6a653b7c37154a1dd79b3c4e34afe6cfc9/src/core_editor/editor.rs#L43-L98
  • We have a selection implementation in at least one of the existing modes (be it visual mode for vim or Shift-Arrow for the non modal emacs-like mode)
  • We are happy with how you configure movements that can affect both the buffer and the general UI (e.g. up/down for history, completion or other menus) We currently have this UntilFound logic that has some implicit rules in how you need to order things and has some edge cases (multiplier motions in vi, left and right movements while in the history scrollback). This is not super critical for the helix implementation concerns itself but I think it makes sense that we have some clarity in how things should be configured on the nushell side so we can drop helix mode in when it is ready (potentially after we stabilize a config format for 1.0)
luccahuguet commented 7 months ago

I will also leave this here: a vscode extension that adds some helix commands. This could bring some insight

https://github.com/jasonwilliams/vscode-helix