[zsh] updating my git prompt
This commit is contained in:
@@ -12,19 +12,13 @@ git_dirty() {
|
|||||||
else
|
else
|
||||||
if [[ $st == "nothing to commit (working directory clean)" ]]
|
if [[ $st == "nothing to commit (working directory clean)" ]]
|
||||||
then
|
then
|
||||||
echo "on %{$fg_bold[green]%}$(git_prompt_info)%{$reset_color%}"
|
echo "%{$fg_bold[green]%}✔ $(git_prompt_info)%{$reset_color%}"
|
||||||
else
|
else
|
||||||
echo "on %{$fg_bold[red]%}$(git_prompt_info)%{$reset_color%}"
|
echo "%{$fg_bold[red]%}✘ $(git_prompt_info)%{$reset_color%}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
git_prompt_info() {
|
|
||||||
ref=$(/usr/bin/git symbolic-ref HEAD 2>/dev/null) || return
|
|
||||||
# echo "(%{\e[0;33m%}${ref#refs/heads/}%{\e[0m%})"
|
|
||||||
echo "${ref#refs/heads/}"
|
|
||||||
}
|
|
||||||
|
|
||||||
unpushed() {
|
unpushed() {
|
||||||
/usr/bin/git cherry -v @{upstream} 2>/dev/null
|
/usr/bin/git cherry -v @{upstream} 2>/dev/null
|
||||||
}
|
}
|
||||||
@@ -34,7 +28,7 @@ need_push() {
|
|||||||
then
|
then
|
||||||
echo " "
|
echo " "
|
||||||
else
|
else
|
||||||
echo " with %{$fg_bold[magenta]%}unpushed%{$reset_color%} "
|
echo " with %{$fg_bold[magenta]%}☁%{$reset_color%} "
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,4 +37,4 @@ directory_name(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
export PROMPT=$'in $(directory_name) $(git_dirty)$(need_push)\n➜ '
|
export PROMPT=$'in $(directory_name) $(git_dirty)$(need_push)\n➜ '
|
||||||
|
export RPROMPT=$'$(git_dirty)$(need_push)'
|
||||||
|
|||||||
Reference in New Issue
Block a user