inquire icon indicating copy to clipboard operation
inquire copied to clipboard

feat: add emacs keymap mode

Open ecklf opened this issue 2 years ago • 5 comments

This PR adds a functionality to enable emacs keybindings for navigating the inquire prompts. As it doesn't make sense to enable multiple keybindings at once I extracted it into an enum (which is a breaking change).

ecklf avatar Feb 08 '23 11:02 ecklf

Cool idea. Is there any env var standard [1] to set this automatically for end users? We could have it implemented in a way that CLI developers wouldn't need to worry about it.

[1] like https://no-color.org/

mikaelmello avatar Mar 03 '23 05:03 mikaelmello

We could check if VISUAL or EDITOR contains "vi" and conditionally set eMacs or vi bindings. Though this may not always be what end users want. Personally, I use vim as my editor, but I prefer eMacs bindings in my cli. I am not sure we can easily extract that information as that’s set up in the users respective shell (zsh/fish/etc.).

ecklf avatar Mar 03 '23 07:03 ecklf

Came here to code this, but glad it already exists! Bumping in hopes this can get merged 💕

ahstro avatar Mar 20 '24 14:03 ahstro

Cool idea. Is there any env var standard [1] to set this automatically for end users? We could have it implemented in a way that CLI developers wouldn't need to worry about it.

[1] like https://no-color.org/

@mikaelmello I like your idea, but unfortunately there is no such var standard to set keybindins mode. Bash uses set -o vi / set -o emacs, zsh uses bindkey -e / bindkey -v etc. I think it would be enough to provide this api (and make emacs mode the default, like most other tools do). App uses inquire can choose whether to set the keybinds mode according to the env variable. What do you think about this?

wfxr avatar Aug 10 '24 12:08 wfxr