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

^R/incr search keybind being overwritten by zsh-vi-mode #1826

Open
schilkp opened this issue Mar 5, 2024 · 2 comments
Open

^R/incr search keybind being overwritten by zsh-vi-mode #1826

schilkp opened this issue Mar 5, 2024 · 2 comments

Comments

@schilkp
Copy link

schilkp commented Mar 5, 2024

Hi!

I just spent 40 minutes debugging why the '^R' mapping for incremental search was not being applied. Long story short: I have 'zsh-vi-mode' installed, which "lazy-loads" its keybind after ~/.zshrc has been sourced. This caused the following keybind from the atuin init script to be overwritten:

bindkey -M viins '^r' aution-search-viins

I fixed this by creating a "callback" (I guess?) to have atuin loaded after zsh-vi-mode sets its keybinds:

# If autin is installed, enable it.
if command -v atuin &> /dev/null; then
    # Note: Since zsh-vi-mode lazy-loads keybinds, it will overwrite
    # Some of the keybinds set by atuin. The following creates a 'callback'
    # that loads atuin after zsh-vi-mode has applied all keymaps.
    function my_init() {
        eval "$(atuin init zsh --disable-up-arrow)"
    }
    zvm_after_init_commands+=(my_init)
fi

To be clear: I don't think this is an autin bug per-se, but thought I would open this issue to ask if there was an appropriate place that this could be added to the documentation to avoid future users running into the same issue :)

It seems others have run into this problem: https://stackoverflow.com/questions/77005631/how-can-i-list-all-sourced-files-in-zsh-init-process

Maybe there is also a way to have the default autin init script handle this? Very possible that this would cause conflicts/mess with peoples setups.

@arcuru
Copy link
Contributor

arcuru commented Mar 10, 2024

Yep, discussed here as well: #977

I think it's reasonable to add it, it's come up several times and it's a very confusing breakage. The problem is we'd need to figure out how to handle the --disable-up-arrow option.

We already integrate with the zsh-autosuggestions plugin, so handling a fairly popular plugin isn't out of the ordinary.

alesauce added a commit to alesauce/nix-home that referenced this issue Aug 3, 2024
Due to how Zsh-vi-mode loads its config, it overrides Atuin's `Ctrl+R`
keybinding. These changes disable Home-Manager's `enableZshIntegration`
option and use `zvm_after_init_commands` to work around the override.

atuinsh/atuin#1826
atuinsh/atuin#977
@Sharparam
Copy link

Relevant issue in the zsh-vi-mode repo: jeffreytse/zsh-vi-mode#299

Sharparam added a commit to Sharparam/nix-config that referenced this issue Jan 27, 2025
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

No branches or pull requests

3 participants