Skip to content

Commit b493b7d

Browse files
committed
Print Git status before first command prompt
1 parent e9edd3c commit b493b7d

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

agkozak-zsh-prompt.plugin.zsh

+13-7
Original file line numberDiff line numberDiff line change
@@ -924,15 +924,21 @@ prompt_agkozak_precmd() {
924924

925925
# Optionally put blank lines between instances of the prompt
926926
(( AGKOZAK_BLANK_LINES && AGKOZAK[FIRST_PROMPT_PRINTED] )) && print
927-
AGKOZAK[FIRST_PROMPT_PRINTED]=1
928927

929928
# Begin to calculate the Git status
930-
case ${AGKOZAK[ASYNC_METHOD]} in
931-
'subst-async') _agkozak_subst_async ;;
932-
'zsh-async') _agkozak_zsh_async ;;
933-
'usr1') _agkozak_usr1_async ;;
934-
*) _agkozak_set_git_psvars "$(_agkozak_branch_status)" ;;
935-
esac
929+
if (( AGKOZAK[FIRST_PROMPT_PRINTED] )); then
930+
case ${AGKOZAK[ASYNC_METHOD]} in
931+
'subst-async') _agkozak_subst_async ;;
932+
'zsh-async') _agkozak_zsh_async ;;
933+
'usr1') _agkozak_usr1_async ;;
934+
*) _agkozak_set_git_psvars "$(_agkozak_branch_status)" ;;
935+
esac
936+
else
937+
# Always print the Git status before the first command prompt
938+
_agkozak_set_git_psvars "$(_agkozak_branch_status)"
939+
fi
940+
941+
AGKOZAK[FIRST_PROMPT_PRINTED]=1
936942

937943
# Clear background job count
938944
psvar[11]=''

0 commit comments

Comments
 (0)