legacy-dotfiles/zsh/functions/prompt_git_info

24 lines
454 B
Text
Raw Normal View History

2010-12-05 12:50:00 +01:00
# -*- mode: shell-script -*-
if [ -n "$__CURRENT_GIT_BRANCH" ]; then
local s="("
s+="$__CURRENT_GIT_BRANCH"
case "$__CURRENT_GIT_BRANCH_STATUS" in
ahead)
2011-03-08 20:38:49 +01:00
s+="^"
2010-12-05 12:50:00 +01:00
;;
diverged)
2011-03-08 20:38:49 +01:00
s+="-/="
2010-12-05 12:50:00 +01:00
;;
behind)
2011-03-08 20:38:49 +01:00
s+="v"
2010-12-05 12:50:00 +01:00
;;
esac
if [ -n "$__CURRENT_GIT_BRANCH_IS_DIRTY" ]; then
2011-03-08 20:38:49 +01:00
s+="*"
2010-12-05 12:50:00 +01:00
fi
s+=")"
printf " %s%s" "%{${fg[yellow]}%}" $s
fi