1
0
Fork 0

Fix git-prompt so that it properly renders the prompt info no matter what order it is loaded in regards to your theme file.

pull/1/head
Ashley Dev 14 years ago
parent bf56eadc22
commit c6cb7e6561

@ -553,13 +553,14 @@ typeset -Uga chpwd_functions
typeset -Uga periodic_functions typeset -Uga periodic_functions
# Append git functions needed for prompt. # Append git functions needed for prompt.
preexec_functions+='preexec_update_git_vars' preexec_functions+='__git_prompt_preexec_update_git_vars'
precmd_functions+='precmd_update_git_vars' precmd_functions+='__git_prompt_precmd_update_git_vars'
chpwd_functions+="$GIT_PROMPT_INFO_FUNC" chpwd_functions+="__git_prompt_info"
PERIOD=15 PERIOD=15
periodic_functions+="$GIT_PROMPT_INFO_FUNC" periodic_functions+="__git_prompt_info"
precmd_update_git_vars() __git_prompt_info () { $GIT_PROMPT_INFO_FUNC }
__git_prompt_precmd_update_git_vars()
{ {
if [[ $ZSH_VERSION = *\ 4.2* ]]; then if [[ $ZSH_VERSION = *\ 4.2* ]]; then
# some older versions of zsh don't have periodic_functions, so do the # some older versions of zsh don't have periodic_functions, so do the
@ -571,31 +572,14 @@ precmd_update_git_vars()
unset __EXECUTED_GIT_COMMAND unset __EXECUTED_GIT_COMMAND
fi fi
} }
__git_prompt_preexec_update_git_vars ()
preexec_update_git_vars ()
{ {
case "$1" in case "$1" in
vim*) $EDITOR*) __EXECUTED_GIT_COMMAND=1 ;;
__EXECUTED_GIT_COMMAND=1 g*) __EXECUTED_GIT_COMMAND=1 ;;
;; rm*) __EXECUTED_GIT_COMMAND=1 ;;
g*) touch*) __EXECUTED_GIT_COMMAND=1 ;;
__EXECUTED_GIT_COMMAND=1 mkdir*) __EXECUTED_GIT_COMMAND=1 ;;
;;
rm*)
__EXECUTED_GIT_COMMAND=1
;;
touch*)
__EXECUTED_GIT_COMMAND=1
;;
mkdir*)
__EXECUTED_GIT_COMMAND=1
;;
# f)
# __EXECUTED_GIT_COMMAND=1
# ;;
# fg)
# __EXECUTED_GIT_COMMAND=1
# ;;
esac esac
} }

Loading…
Cancel
Save