# prompt function prompt_git_dirty() { gitstat=$(git status 2>/dev/null | grep '\(# Untracked\|# Changes\|# Changed but not updated:\)') if [[ $(echo ${gitstat} | grep -c "^# Changes to be committed:$") > 0 ]]; then echo -n $PR_LIGHT_YELLOW elif [[ $(echo ${gitstat} | grep -c "^\(# Untracked files:\|# Changed but not updated:\)$") > 0 ]]; then echo -n $PR_LIGHT_RED else echo -n $PR_LIGHT_MAGENTA fi } function prompt_current_branch() { ref=$(git symbolic-ref HEAD 2> /dev/null) || return 1 echo ${ref#refs/heads/} } function prompt_hostname() { case "`hostname`" in "Arch") echo -n "${PR_LIGHT_YELLOW}Arch${PR_NO_COLOR}";; esac } function precmd() # Uses: setting user/root PROMPT1 variable and rehashing commands list { # Last command status cmdstatus=$? sadface=`[ "$cmdstatus" != "0" ] && echo "${PR_RED}:(${PR_NO_COLOR} "` # Colours usercolour=`[ $UID != 0 ] && echo $PR_BLUE || echo $PR_RED` usercolour2=`[ $UID != 0 ] && echo $WHITE || echo $PR_RED` dircolour=`[ -w "\`pwd\`" ] && echo $PR_YELLOW || echo $PR_RED` # Git branch git="[branch: `prompt_git_dirty``prompt_current_branch`${blue}]" export PROMPT=" ${usercolour}┌─[${dircolour}%n${PR_NO_COLOR}«»`prompt_hostname`${usercolour}]─────────────────────────${dircolour}[%~]${PR_NO_COLOR} `prompt_current_branch &>/dev/null && echo -n $git` ${usercolour}└─${sadface}${usercolour}${dircolour}(%T)(%l)${usercolour}keep it simple ─╼ ${PR_NO_COLOR}" } # #based on Barrucadu (prompt):https://bbs.archlinux.org/viewtopic.php?pid=831695#p831695 #