From 552942f8982b70d66ac6c2f4ad9426801e388289 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Mon, 6 Sep 2021 22:34:31 +1200 Subject: [PATCH 1/1] update prompt vars after git command runs --- .zsh/zshrc/parts.d/50-git | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.zsh/zshrc/parts.d/50-git b/.zsh/zshrc/parts.d/50-git index da11bf8..9419e15 100644 --- a/.zsh/zshrc/parts.d/50-git +++ b/.zsh/zshrc/parts.d/50-git @@ -60,6 +60,13 @@ __git_set_prompt_variable() { add-zsh-hook chpwd __git_set_prompt_variable __git_set_prompt_variable +__update_git_prompt_vars_if_git_ran() { + case "$(history $(($HISTCMD - 1)))" in + *git*) __git_set_prompt_variable + esac +} +add-zsh-hook precmd __update_git_prompt_vars_if_git_ran + __git_print_preprompt() { [[ $? -eq 0 ]] || return -- 2.39.5