fix(zsh): add key binding conditionally

This commit is contained in:
Jan De Dobbeleer 2022-10-24 16:47:25 +02:00 committed by Jan De Dobbeleer
parent 7576a1e9a5
commit 972c3c1048

View file

@ -112,6 +112,13 @@ if [[ "::TRANSIENT::" = "true" ]]; then
# https://github.com/JanDeDobbeleer/oh-my-posh/discussions/2617#discussioncomment-3911044
bindkey '^[[F' end-of-line
bindkey '^[[H' beginning-of-line
_widgets=$(zle -la)
if [[ -n "${_widgets[(r)down-line-or-beginning-search]}" ]]; then
bindkey '^[[B' down-line-or-beginning-search
fi
if [[ -n "${_widgets[(r)up-line-or-beginning-search]}" ]]; then
bindkey '^[[B' up-line-or-beginning-search
fi
fi
# legacy functions for backwards compatibility