reedline icon indicating copy to clipboard operation
reedline copied to clipboard

Custom line editing

Open thomasschafer opened this issue 11 months ago • 8 comments

Related problem

Hi, I'd really like to be able to implement completely custom keybindings, in the same way as can be done using Zsh-Line-Editor in Zsh, which makes plugins such as https://github.com/jeffreytse/zsh-vi-mode possible. The only way I can see to implement this currently is to create custom keybindings with Reedline and then fork Nushell to use them. Is there an alternative solution I'm missing?

Describe the solution you'd like

A straightforward way to swap in custom keybindings

Describe alternatives you've considered

No response

Additional context and details

No response

thomasschafer avatar Jan 20 '25 22:01 thomasschafer

Nushell supports custom keybindings as explained here on the reedline page. Does this meet your needs, and if not what specifically are you looking to be able to do that the current functionality doesn't provide?

132ikl avatar Jan 20 '25 23:01 132ikl

Nushell supports custom keybindings as explained here on the reedline page. Does this meet your needs, and if not what specifically are you looking to be able to do that the current functionality doesn't provide?

I’m hoping to implement an entirely different way of navigating the buffer, using Helix-style keybindings, that will be completely independent from the built-in emacs or vi modes. Given this I don’t think the keybindings described in the docs will be suitable, unfortunately

thomasschafer avatar Jan 20 '25 23:01 thomasschafer

I’ve just updated the title to “Custom line editing” as I guess this is what I really want, not just custom keybindings

thomasschafer avatar Jan 20 '25 23:01 thomasschafer

Reedline is limited with its keybindings because, in vi mode, the default/internal mappings take precedence/override user mappings (which makes zero sense to me). That needs to be fixed imo. Also the vi mode isn't quite correct (w jumps overs periods, cursor goes past EOL in normal mode where hitting x gets stuck, 999dl delete chars on following lines, etc.), and might need to be fixed as well.

tmillr avatar Jan 20 '25 23:01 tmillr

Transferred to reedline since it's the line editor that nushell uses.

fdncred avatar Jan 20 '25 23:01 fdncred

Transferred to reedline since it's the line editor that nushell uses.

Thanks for this. I'd be happy to take a look at adding PRs to both reedline and nushell if there would be appetite to add this? Are there any objections?

thomasschafer avatar Jan 29 '25 14:01 thomasschafer

No objections. I'd love to see our vim keybinding improved and functionality augmented with helix-style keybinds. The only thing I worry about is reviewing such a PR. If you take it on, it would be nice to make several PRs so they are reviewable. It's already very difficult to get people to review any PR in this repo much less large ones.

fdncred avatar Jan 29 '25 15:01 fdncred

That makes sense, I’ll be sure to break any changes up in to manageable PRs - thanks!

thomasschafer avatar Jan 29 '25 15:01 thomasschafer