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
Add vim mode to FuzzySelect
#259
Conversation
Add configuration option to enable vim mode to `FuzzySelect`
- Rename `FuzzySelect::enable_vim_mode` to `FuzzySelect::vim_mode`. - Implement quitting in vim_mode. - Remove `vim_mode = false` when a character is entered.
@@ -209,6 +221,8 @@ impl FuzzySelect<'_> { | |||
|
|||
term.hide_cursor()?; | |||
|
|||
let mut vim_mode = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this default to enable_vim_mode
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not. enable_vim_mode is meant to fully disable vim mode; the vim_mode variable keeps track of when you are entering text or when vim bindings are used. Typically you'd fuzzy find first, then use vim mode, So I think it should always start with no vim mode.
Change the quit key to be 'q' instead of Escape.
This pull request introduces a vim mode to
FuzzySelect
.Vim mode works as follows:
This is based on the vim mode from https://github.com/go-survey/survey.
To achieve this I've added the following changes:
vim_mode
.vim_mode
is true.FuzzySelect::enable_vim_mode
method.These changes have the following benefits:
I hope my contribution can be of use!