-
-
Notifications
You must be signed in to change notification settings - Fork 507
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(search): introduce keymap-dependent vim-mode #1570
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Nice, that works about how I'd expect. I wonder if the generated key-bindings should be changed based on vim-mode too. Currently the |
Hmm, I agree. In fact, in the Bash integration, we avoid to overwrite C-r in Bash's vi-command keymap: atuin/atuin/src/shell/atuin.bash Lines 226 to 232 in c2439d1
I think we can add the keybinding to / in a default set of the keybindings. On the other hand, I'm not sure if we can remove the keybinding to C-r from
I assume them to be a part of the public interface because they seem to appear in a sample configuration: (Edit) If they are really a part of the public interface, maybe should we rename them so that they do not start with |
I thought about it again, and I think another option for the configuration interface would be to provide a single configuration |
I implemented this in the latest commit 96eeca0. I feel this is cleaner, though we have discussed the global config |
@@ -159,9 +153,9 @@ impl State { | |||
// core input handling, common for all tabs | |||
match input.code { |
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.
Let's avoid extending this match in any future PRs, it's huge and getting difficult to understand. It would make sense to abstract this out, but I'll make an issue for this. Happy with this for now.
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.
I also thought about it, but I kept it since you seemed to have an idea in #1553 (review).
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.
Looks good to me, thank you!
Would you also be able to update the docs please?
ah and the shellcheck |
Thank you! I've fixed SC2048, rebased on top of the latest |
I opened atuinsh/docs#8 in atuin/docs. |
This describes the widgets and options introduced by atuinsh/atuin#1570
Commit b8c6b9a corresponds to the widget name change introduced in atuinsh/atuin#1631. Also, the current documentation diverges from the current implementation. I updated the widgets for the <kbd>up</kbd> key in commit 6e1f3df. Also, the descriptions for the newly added widgets for `keymap_mode` (atuinsh/atuin#1570) are added in commit 705214a. Since the version dependence of documentation can confuse people as in atuinsh/atuin#1625, I decided to add a note on the version dependence and also a required version for each feature. I personally think it is useful to maintain in the documentation the minimal version requirement for each feature, but this might be the perspective of a developer who needs to consider the compatibility of products with arbitrary versions of other products. If you have a different preference, please tell me that. There is an extra commit 33a1d6d. Sorry, this is unrelated to the widget name but a tiny clarification of a description I added in my previous PR #10. If I should submit a change in a separate PR, please tell me that. It's a small change, but I'll create a separate one if you'd prefer it.
This is a possible refinement to the vim mode as suggested in #1553 (comment).
In this PR, we introduce three keymap modes,
emacs
,vim-insert
, andvim-normal
(which was extended from the currentVimMode
). When the configvim
is enabled, the keys are processed with special rules for the current keymap mode. This is actually the same as the currentmain
. The real behavioral change is related to the following configkeymap_mode
:The keymap mode with which the Atuin search is started is controlled by the config
keymap_mode
. Whenkeymap_mode
is not specified, the keymap mode on the startup is determined based on the shell's keymap that started the Atuin search. When the configkeymap_mode
is specified, the keymap mode on the startup is forced to be the specified one.@YummyOreo @ellie What do you think of this interface? If you have another idea, I can adjust the PR.