reedline icon indicating copy to clipboard operation
reedline copied to clipboard

Discussion: will reedline become a full-fledged "text editor?"

Open Jasha10 opened this issue 1 year ago • 8 comments

This issue is to discuss direction and scope of reedline's "text editor" and "IDE" features.

The goal of PR #670 was "allowing the user to press "jk" (without modifiers) to move from Vi insert mode to Vi normal mode." In that PR, @benvansleen said:

Achieving this with the existing keybindings section would require implementing something akin to emacs key-chords (since you press one key, release, then press the next). That would be a much, much wider-reaching change.

This seems related to the question of "how many full-fledged text editor features should be added to reedline?" Heavy-duty text editors like vim essentially allow the user to configure a state machine where a given keypress will have a different effect depending on the current state. (For example, the keypress 'k' would have a different effect depending on if the user is in "insert" mode or "normal" mode, and also depending on whether the 'k' immediately followed a 'j'.)

Does it make sense for reedline to move in the above direction (implementing a user-configurable state machine)? Related are questions regarding how many other "text editor" features should be included (e.g. vim allows for user-configurable callbacks, plugins, keymaps to trigger system calls or perform arbitrary turing-complete logic, etc).

I think it could be helpful to discuss vision for how far reedline will move in the direction of becoming a "text editor" / "IDE." Having a vision for this will help to ensure that:

  • new features are added in a manner that's consistent with overall vision for user experience, and
  • the implementation decisions made in adding new features will not be counterproductive to progress on other planned features.

Related:

  • https://github.com/nushell/reedline/issues/63

Jasha10 avatar Nov 16 '24 15:11 Jasha10

We've wanted to have better VI keybinding functionality for a long time. You can see some of our brainstorming ideas https://github.com/nushell/reedline/issues/69, which is linked from the meta issue that you mention above.

I think reedline should cover as much functionality as is supportable. An example of what I mean by that is I like the idea of a user configurable state machine like you mention above. However, if there's no one to write it and no one to maintain it, then it's probably not something reedline should have.

I think this is the problem with many open-source projects. There are a lot of plans and ideas but unless someone comes along to implement and support some feature, it goes undone. Since we're all volunteers, we just work on things that interest us. There is a bug in reedline that has been there for years and prevents WezTerm from working properly. My solution to that was to move to Ghostty because I couldn't figure out the solution.

So, it's probably less a matter of what we want, although that's a good starting place, and more of a matter of who will write it and support it for the community.

fdncred avatar Nov 16 '24 16:11 fdncred

Has outsourcing the modal editing logic to a third-party dependency been considered as an option? e.g. https://github.com/ulyssa/modalkit

I would expect this to address the open issues regarding the limitations of the edit modes and reduce the associated maintenance burden.

HartBlanc avatar Dec 22 '24 20:12 HartBlanc

Has outsourcing the modal editing logic to a third-party dependency been considered as an option? e.g. https://github.com/ulyssa/modalkit

I would expect this to address the open issues regarding the limitations of the edit modes and reduce the associated maintenance burden.

Never heard of it, but we're probably open to it.

fdncred avatar Dec 22 '24 21:12 fdncred

Any update on this part? I would love typing out old school jk as I do everywhere. Thank you!

HamzaMateen avatar Apr 19 '25 08:04 HamzaMateen

I am working on redoing the editing using modalkit as @HartBlanc mentioned. I have a working copy locally but it's very messy right now. I would like confirmation if it's okay to rely on an external library to take care of the editing or if only in-house tools are allowed for something this big.

bonofiglio avatar Jul 29 '25 23:07 bonofiglio

I would like confirmation if it's okay to rely on an external library to take care of the editing or if only in-house tools are allowed for something this big.

Can you talk more about this? Is there a specific crate you're wanting to use? Is modalkit not good enough or are you asking permission to use modalkit?

fdncred avatar Jul 30 '25 00:07 fdncred

I would like confirmation if it's okay to rely on an external library to take care of the editing or if only in-house tools are allowed for something this big.

Can you talk more about this? Is there a specific crate you're wanting to use? Is modalkit not good enough or are you asking permission to use modalkit?

Sorry if I wasn't clear enough. I'm asking for permission specifically for modalkit. It would basically replace all of the editor functionality by itself, so it's a pretty big change.

bonofiglio avatar Jul 30 '25 01:07 bonofiglio

ya, i've been pushing modalkit for a while now. that's the crate i'd choose. it's just non-trivial.

fdncred avatar Jul 30 '25 02:07 fdncred