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

feat: add emacs keymap mode #94

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat: add emacs keymap mode #94

wants to merge 1 commit into from

Conversation

ecklf
Copy link

@ecklf ecklf commented Feb 8, 2023

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).

@mikaelmello
Copy link
Owner

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/

@ecklf
Copy link
Author

ecklf commented Mar 3, 2023

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.).

@ahstro
Copy link

ahstro commented Mar 20, 2024

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

@wfxr
Copy link

wfxr commented Aug 10, 2024

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?

@soywod
Copy link

soywod commented Oct 10, 2024

Any news about this feature? I'm willing to help if needed. IMHO, environment variables should not be checked by the lib, it's not its responsibility. Lib users should explicitly define the desired keymap mode, and it should be interfaced with final users' preferences (at higher level, like applications). Exactly how does shells like bash or zsh.

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

Successfully merging this pull request may close these issues.

5 participants