feat(zsh): trigger a tip check only on a space key input

This commit is contained in:
L. Yeung 2022-05-20 21:52:37 +08:00 committed by Jan De Dobbeleer
parent 6612780fd0
commit b3b4f473b5

View file

@ -48,7 +48,10 @@ function self-insert() {
zle .self-insert
return
fi
# trigger a tip check only if the input is a space character
if [[ "$KEYS" = " " ]]; then
tooltip=$(::OMP:: print tooltip --config="$POSH_THEME" --shell=zsh --command="$BUFFER" --shell-version="$ZSH_VERSION")
fi
# ignore an empty tooltip
if [[ ! -z "$tooltip" ]]; then
RPROMPT=$tooltip