databricks / click

The "Command Line Interactive Controller for Kubernetes"
Apache License 2.0
1.49k stars 84 forks source link

Support vi-mode for readline #39

Closed wieslaw-gat closed 2 years ago

wieslaw-gat commented 6 years ago

Any chances of adding a vi-mode to click?

I'm currently using the following:

diff --git a/Cargo.toml b/Cargo.toml
-rustyline = "1.0"
+rustyline = { git = "https://github.com/kkawakam/rustyline" }

diff --git a/src/main.rs b/src/main.rs
-    let mut rl = Editor::<ClickCompleter>::new();
+    let editor_config = rustyline::Config::builder().edit_mode(rustyline::EditMode::Vi).build();
+    let mut rl = Editor::<ClickCompleter>::with_config(editor_config);

and it works :ok_hand:, but it would be much better to set this as a configuration option in click itself.

Unfortunately my rust-fu is too weak to hack this in properly :disappointed:

nicklan commented 6 years ago

Yeah, I'd love to have a new release of rustyline. I've actually even emailed the maintainer and tried to get him to invite more people to the project to move it forward. See this issue: https://github.com/kkawakam/rustyline/issues/89

I'll investigate moving to a git version since it doesn't seem like it'll be happening anytime soon.

nicklan commented 2 years ago

this is supported now, set edit_mode vi