From: martin f. krafft Date: Mon, 6 Sep 2021 10:34:31 +0000 (+1200) Subject: update prompt vars after git command runs X-Git-Url: https://git.madduck.net/etc/git.git/commitdiff_plain/552942f8982b70d66ac6c2f4ad9426801e388289?hp=821d3028f391ed1659186b68659d902dd0a2713e update prompt vars after git command runs --- 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