From b3b4f473b5b622d50ce04633697dc11d221fbf25 Mon Sep 17 00:00:00 2001 From: "L. Yeung" Date: Fri, 20 May 2022 21:52:37 +0800 Subject: [PATCH] feat(zsh): trigger a tip check only on a space key input --- src/shell/scripts/omp.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shell/scripts/omp.zsh b/src/shell/scripts/omp.zsh index 59ae080b..9e816bb3 100644 --- a/src/shell/scripts/omp.zsh +++ b/src/shell/scripts/omp.zsh @@ -48,7 +48,10 @@ function self-insert() { zle .self-insert return fi - tooltip=$(::OMP:: print tooltip --config="$POSH_THEME" --shell=zsh --command="$BUFFER" --shell-version="$ZSH_VERSION") + # 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