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

vi-style keybinding mode? #365

Open
bsidhom opened this issue Feb 21, 2024 · 5 comments
Open

vi-style keybinding mode? #365

bsidhom opened this issue Feb 21, 2024 · 5 comments

Comments

@bsidhom
Copy link

bsidhom commented Feb 21, 2024

Adding more general readline-style support could make it much easier to edit/reuse long inputs, especially given that there's no mouse support. I assume that there's some baked-in Emacs-style bindings at the moment, but my fingers aren't familiar with that. 🙂

It may be possible to get this support for free (e.g., using configuration via .inputrc) with a readline-like crate, assuming such a thing exists.

@sharkdp
Copy link
Owner

sharkdp commented Feb 21, 2024

We currently use rustyline as a library. It does not seem to support this feature, unfortunately (fellow vim user here):

@sharkdp
Copy link
Owner

sharkdp commented Feb 21, 2024

Might be worth looking into https://github.com/nushell/reedline

@bsidhom
Copy link
Author

bsidhom commented Feb 22, 2024

Those bugs seem to relate to a ~/.inputrc-like config. The existence of InputMode and the vi mode section on crates.io suggest that this can be enabled somehow in rustyline. (I haven't looked into this yet.)

On the other hand, reedline does look pretty slick. Setting up vi-mode is as simple as changing the import line and editor instantiation in the example:

use reedline::{DefaultPrompt, Reedline, Signal, Vi};
let mut line_editor = Reedline::create().with_edit_mode(Box::new(Vi::default()));

I wonder if either supports a WASM target, which may allow us to get rid of the JS terminal emulator in "desktop" mode on the web.

@sharkdp
Copy link
Owner

sharkdp commented Feb 22, 2024

which may allow us to get rid of the JS terminal emulator in "desktop" mode on the web.

I don't see how? We would not need a terminal emulator + readline interface (which is what jquery.terminal provides for us). But we would still need a terminal emulator for the browser. Something like https://xtermjs.org/ (which is extremely low-level).

@bsidhom
Copy link
Author

bsidhom commented Feb 22, 2024

You’re right. I wanted to say “pseudo terminal emulator” to describe that but I didn’t mean ptty. A true terminal emulator would give better fidelity and parity with the cli app. Anyway, it could let us drop the…terminal emulator emulator? I assume xtermjs is pretty heavy, so it might make sense to fork the web app or conditionally load resources in that case based on the device type (assuming mobile UI comes to fruition).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants