@ -6,12 +6,15 @@ function __prompt_command {
local R='\[\e[0m\]'
local R='\[\e[0m\]'
local Red='\[\e[31m\]'
local Red='\[\e[31m\]'
local Gre='\[\e[32m\]'
local Gre='\[\e[32m\]'
local Yel='\[\e[3 3m\]'
local Yel='\[\e[9 3m\]'
local Blu='\[\e[34m\]'
local Blu='\[\e[34m\]'
local Cya='\[\e[36m\]'
local Cya='\[\e[36m\]'
local Mag='\[\e[95m\]'
local Mag='\[\e[95m\]'
local Gra='\[\e[90m\]'
local Gra='\[\e[90m\]'
local DIVERGENT_GIT_SYMBOL="${Yel}➾${R}"
local SYNCHRONIZED_GIT_SYMBOL="${Gre}✔${R}"
# set xterm title
# set xterm title
echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"
echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"
@ -65,6 +68,7 @@ function __prompt_command {
if git rev-parse --git-dir >/dev/null 2>&1; then
if git rev-parse --git-dir >/dev/null 2>&1; then
# current dir is version controlled
# current dir is version controlled
local branch tag_release dirty
local branch tag_release dirty
branch=$(git branch 2>/dev/null | grep -e ^* | cut -d ' ' -f2)
branch=$(git branch 2>/dev/null | grep -e ^* | cut -d ' ' -f2)
PS1+=" ${R}[${Mag}${branch}${R}|"
PS1+=" ${R}[${Mag}${branch}${R}|"
@ -72,16 +76,25 @@ function __prompt_command {
tag_release=$(git describe --tags 2>/dev/null | cut -d'-' -f1)
tag_release=$(git describe --tags 2>/dev/null | cut -d'-' -f1)
dirty=$(git status -s | wc -l)
dirty=$(git status -s | wc -l)
if [[ $dirty -ne 0 ]]; then
if [[ $dirty -ne 0 ]]; then
PS1+="⚡ |${tag_release}${Yel}…$dirty"
PS1+="${Yel}${DIVERGENT_GIT_SYMBOL}${R} |${tag_release}${Yel}…$dirty"
else
else
local ahead=$(git rev-list --branches --not --remotes | wc -l)
local ahead
ahead=$(git rev-list --branches --not --remotes | wc -l)
if [[ $ahead -ne 0 ]]; then
if [[ $ahead -ne 0 ]]; then
PS1+="⚡|${tag_release}${Cya}↑${ahead}"
PS1+="${DIVERGENT_GIT_SYMBOL}|${tag_release}${Cya}↶ ${ahead}"
else
else
if [[ -z $tag_release ]]; then
if [[ -z $tag_release ]]; then
PS1+="${Blu}✔ "
PS1+="${SYNCHRONIZED_GIT_SYMBOL} "
else
else
PS1+="${Gre}✔${R}|${Blu}${tag_release}"
local commit_ahead
commit_ahead=$(git log "$tag_release"..HEAD --oneline | wc -l)
if [[ $commit_ahead -gt 0 ]]; then
PS1+="${DIVERGENT_GIT_SYMBOL}|${tag_release}${Yel}↟${commit_ahead}"
else
PS1+="${SYNCHRONIZED_GIT_SYMBOL}|${Cya}${tag_release}"
fi
fi
fi
fi
fi
fi
fi