about summary refs log tree commit diff
path: root/.config
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2022-11-29 16:04:21 -0600
committerStarfall <us@starfall.systems>2022-11-29 16:04:21 -0600
commitf58e953488db98c32972df2802cf631f9d4dd21e (patch)
treeaed51f31fc34909968888c380612a091f86b75db /.config
parent288df6c0601166a4279cb560f4e4f64cb9550b78 (diff)
zsh: use add-zsh-hook for git info on prompt
Diffstat (limited to '.config')
-rw-r--r--.config/zsh/prompt.zsh5
1 files changed, 4 insertions, 1 deletions
diff --git a/.config/zsh/prompt.zsh b/.config/zsh/prompt.zsh
index 81e3664..6ae208e 100644
--- a/.config/zsh/prompt.zsh
+++ b/.config/zsh/prompt.zsh
@@ -8,9 +8,12 @@ autoload -Uz vcs_info
 zstyle ':vcs_info:*' enable git
 zstyle ':vcs_info:*' actionformats '%F{purple}[%F{green}%b%F{olive}|%F{red}%a%F{purple}]%f '
 zstyle ':vcs_info:*' formats '%F{purple}[%F{green}%b%F{purple}]%f '
-precmd () { 
+
+get_git () {
 	[[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" == "true" ]] && vcs_info || vcs_info_msg_0_=""
 }
+autoload -Uz add-zsh-hook
+add-zsh-hook precmd get_git
 
 user="%n"
 if [[ -n "$SSH_CLIENT" || "$USER" == "root" ]]; then