Skip to content

[Bug]: zsh keybindings in .zshrc is overriden somewhere #868

@zeerayne

Description

@zeerayne

Description

I'm using special keybinding for arrow up and arrow down button in my .zshrc:

bindkey "${terminfo[kcuu1]}"  history-substring-search-up
bindkey "^[[A"                history-substring-search-up

bindkey "${terminfo[kcud1]}"  history-substring-search-down
bindkey "^[[B"                history-substring-search-down

But when shell loads if I query what is binded, it will be other fucntion:

❯ bindkey "${terminfo[kcuu1]}"
"^[OA" up-line-or-beginning-search

Keybind can be set properly using completions:

❯ cat ~/.config/zsh/completions/keybindings.zsh
# Autocompletion using arrow keys (based on history)
## Arrow up
bindkey "${terminfo[kcuu1]}"  history-substring-search-up
bindkey "^[[A"                history-substring-search-up
## Arrow down
bindkey "${terminfo[kcud1]}"  history-substring-search-down
bindkey "^[[B"                history-substring-search-down

This is workaround, but it will be cool if keybinds can be set from .zshrc

Steps to Reproduce

  1. Install plugin zsh-history-substring-search
  2. Enable plugin in user.zsh
    plugins=(
        ...
        "zsh-history-substring-search"
        ...
    )
  3. Put bindkey to .zshrc
    bindkey "${terminfo[kcuu1]}"  history-substring-search-up
    bindkey "^[[A"                history-substring-search-up
    
    bindkey "${terminfo[kcud1]}"  history-substring-search-down
    bindkey "^[[B"                history-substring-search-down
  4. Query bindings from terminal using bindkey "${terminfo[kcuu1]}"

Expected Behavior

.zshrc should have highest priority and override all others.

Actual Behavior

.zshrc is overriden by _load_omz_on_init() which is loaded asynchronously, and thats why workaround with completions work.

Screenshots

No response

Environment

hyprland_systeminfo.txt

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    [dev] bugIssues in devbugSomething isn't workingdevissues in regards to deb branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions