AlecAivazis / survey

A golang library for building interactive and accessible prompts with full support for windows and posix terminals.
MIT License
4.08k stars 351 forks source link

Suggestion: Let Ctrl+j/k to navigate up and down in Multiline Question #297

Closed wanecek closed 3 years ago

wanecek commented 3 years ago

What

When prompted with e.g. a MultilineQuestion, I would love it if Ctrl+j/Ctrl+k mapped to ArrowUp and ArrowDown respectively.

Why

This would accommodate for users who prefer vim(-like) keybindings. As far as I can tell, this would'nt interfere with normal usage of the library.

One example of another projects using this keybinding is junegunn/fzf.

I realize this may be slightly niched, and fully understand if this just falls under the category feature-creep. It may also be better solved on the users' side, e.g. by having the terminal emulator do the mapping. Thoughts?

AlecAivazis commented 3 years ago

hey @wanecek currently the user can enter/exit vim mode by pressing the escape key. Does that work for you? I'm not sure having two separate keyboard-based navigation schemes is worth the extra complexity

wanecek commented 3 years ago

Huh. I had no idea, thank you very much for clarifying. That should accommodate my use-case, thank you. Now that you mentioned it, I even found it written out in the README :facepalm:.

Thanks for taking your time to reply, I'll close this issue.

AlecAivazis commented 3 years ago

Awesome! Glad to hear that works. Let me know if you run into any more issues!

niksingh710 commented 1 year ago

hey @wanecek currently the user can enter/exit vim mode by pressing the escape key. Does that work for you? I'm not sure having two separate keyboard-based navigation schemes is worth the extra complexity

That's awesome but is there any way so that I can map any other key to work as esc e.g quickly pressing jk as esc as it matches the vim config and doesn't break my flow?