mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
add comment, fix a performance bug when $EDITOR is not set, reformat.
This commit is contained in:
parent
8d819d2b07
commit
459ebef612
1 changed files with 13 additions and 2 deletions
|
|
@ -584,6 +584,10 @@ precmd_functions+='_git_prompt__precmd_update_git_vars'
|
||||||
chpwd_functions+="_git_prompt_info"
|
chpwd_functions+="_git_prompt_info"
|
||||||
PERIOD=15
|
PERIOD=15
|
||||||
periodic_functions+="_git_prompt_info"
|
periodic_functions+="_git_prompt_info"
|
||||||
|
|
||||||
|
# Prime the pump; this will be executed before PROMPT is defined by the theme, So
|
||||||
|
# make sure the first prompt when the shell is opened has the git info set
|
||||||
|
# properly.
|
||||||
_git_prompt_info
|
_git_prompt_info
|
||||||
|
|
||||||
_git_prompt__precmd_update_git_vars()
|
_git_prompt__precmd_update_git_vars()
|
||||||
|
|
@ -601,16 +605,23 @@ _git_prompt__precmd_update_git_vars()
|
||||||
_git_prompt__preexec_update_git_vars ()
|
_git_prompt__preexec_update_git_vars ()
|
||||||
{
|
{
|
||||||
case "$1" in
|
case "$1" in
|
||||||
$EDITOR*) __EXECUTED_GIT_COMMAND=1 ;;
|
|
||||||
g*) __EXECUTED_GIT_COMMAND=1 ;;
|
g*) __EXECUTED_GIT_COMMAND=1 ;;
|
||||||
rm*) __EXECUTED_GIT_COMMAND=1 ;;
|
rm*) __EXECUTED_GIT_COMMAND=1 ;;
|
||||||
touch*) __EXECUTED_GIT_COMMAND=1 ;;
|
touch*) __EXECUTED_GIT_COMMAND=1 ;;
|
||||||
mkdir*) __EXECUTED_GIT_COMMAND=1 ;;
|
mkdir*) __EXECUTED_GIT_COMMAND=1 ;;
|
||||||
echo*) __EXECUTED_GIT_COMMAND=1 ;;
|
echo*) __EXECUTED_GIT_COMMAND=1 ;;
|
||||||
|
$EDITOR*)
|
||||||
|
if [[ -n "$EDITOR" ]]; then
|
||||||
|
__EXECUTED_GIT_COMMAND=1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
#--------------------------------------------------
|
#--------------------------------------------------
|
||||||
|
|
||||||
git_prompt_info2() { echo $_GIT_PROMPT_INFO }
|
git_prompt_info2()
|
||||||
|
{
|
||||||
|
echo $_GIT_PROMPT_INFO
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue