-
-
Notifications
You must be signed in to change notification settings - Fork 508
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(ui): vim mode #1553
feat(ui): vim mode #1553
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
LGTM! Thanks!
I'd love to flesh this out some more, but let's not do it here. That match is already huge, it would be great to handle keys in a more flexible way
Just gonna need a format |
I'm not sure if we should modify it in this PR, but as far as I understand, the setting of this PR defines the common behavior of all the three keymaps (emacs, vi-insert, and vi-command, or similar ones) at the same time. However, it is natural to behave like emacs when Atuin is called from the emacs keymap, like vi-insert when from the vi-insert keymap, and like vi-normal when from the vi-normal keymap. Wouldn't it be possible to switch the behavior through a command-line option depending on the keymap where the keybinding is defined? |
100%, I'm happy to leave this as-is for now, as it's a super-minimal vim mode
Possibly. I'm not sure how I feel about the idea
I'd love to explore this in the future when we have more vim parity, but for now, keeping the switch explicit is the best approach imo. |
Thank you for your thoughts! Actually, when I adjusted the keybindings of Bash, I also had the same feeling as #391 (comment) about the current keybinding of k in Bash's In my understanding of the mental model, the up and k keybindings try to somehow mimic the shell's behavior of recalling the command history. Inside the shell's vi-command mode, k means to move to the previous entry in the command history. However, this differs from the current behavior of Note that when I use the vi mode in Bash, I switch between vi-insert and vi-command. The current PR could be consistent for people who only use the vi-command mode and never enter the vi-inert mode of the shell, but I cannot imagine how to use the shell in that way. Can I open an independent PR after this is merged?
Makes sense. Can we have a global option
I think those who don't use the vim mode in the shell wouldn't be affected when the behavior is determined by the shell's keymap because the shell's keymap doesn't become the vim mode for those people.
I agree that we don't have to try to implement the real Vim mode. But I feel it's a matter independent of the current discussion.
I wouldn't request to make it an editor. As far as we bind Atuin's search to k, pressing multiple k should behave similarly to the shell's binding because we typically press k multiple times to move around in the history if we are in the vi-normal mode of the shell. However, it shouldn't cause the history movement inside the vi-insert mode. Another option might be to remove Atuin's keybinding to k from the default ones. That confuses people. People who would like it can define the keybindings by themselves. Even in that case, at least I would like to have a way to switch the behavior in the shell's vi-normal and vi-insert.
|
You're welcome to PR, I'm happy with those suggestions - I wasn't disagreeing with you at all fwiw, my only concern is automatically enabling vi mode. I'm happy for us to open in normal mode when invoked from normal, and vice-versa for insert. Just I'd rather avoid doing so unless |
This doesn't match my intuition for how the modes should start, I use zsh vim keybindings and I tried using this along with bindkey -a / _atuin_search_widget
bindkey -a k _atuin_up_search_widget instead of the default bindings. Both of those are triggered from normal mode, but I would expect EDIT: Ah, I see there's a new PR for it, I'll test out its behavior and post there. |
Thanks, I forgot to mention this PR in the new PR. (edit: Now I added it.) The new PR doesn't switch the behavior based on the key, but you can suggest a detailed behavior there. I can update the PR if we come up with a reasonable interface. |
This adds a vim mode: j and k to go up and down the list and i to enter insert mode. has to be enabled in config by adding vim = true
Possible other stuff