inquire
inquire copied to clipboard
feat: add emacs keymap mode
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).
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/
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.).
Came here to code this, but glad it already exists! Bumping in hopes this can get merged 💕
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?