function git_prompt_info { local ref=$(=git symbolic-ref HEAD 2> /dev/null) local gitst="$(=git status 2> /dev/null)" if [[ -f .git/MERGE_HEAD ]]; then if [[ ${gitst} =~ "unmerged" ]]; then gitstatus=" %{$fg[red]%}unmerged%{$reset_color%}" else gitstatus=" %{$fg[green]%}merged%{$reset_color%}" fi elif [[ ${gitst} =~ "Changes to be committed" ]]; then gitstatus=" %{$fg[blue]%}!%{$reset_color%}" elif [[ ${gitst} =~ "use \"git add" ]]; then gitstatus=" %{$fg[red]%}!%{$reset_color%}" elif [[ -n `git checkout HEAD 2> /dev/null | grep ahead` ]]; then gitstatus=" %{$fg[yellow]%}*%{$reset_color%}" else gitstatus='' fi if [[ -n $ref ]]; then echo "%{$fg[green]%}⎇ %{$fg_bold[green]%}${ref#refs/heads/}%{$reset_color%}$gitstatus" fi } function printUser { if [[ -n "$SSH_CLIENT" ]] || [[ -n "$SSH_TTY" ]]; then echo -n "%{$reset_color%}" echo -n "%{$fg[yellow]%}%n%{$fg_bold[black]%}@" echo -n "%{$reset_color%}" case $(hostname) in dingleberry) echo -n "%{$fg[cyan]%}" ;; ladybug) echo -n "%{$fg_bold[green]%}" ;; bimbobee) echo -n "%{$fg_bold[blue]%}" ;; lcech-mac) echo -n "%{$fg[cyan]%}" ;; *) echo -n "%{$fg_bold[red]%}" ;; esac echo "%M " fi } function printAwsVault { if [[ -n "$AWS_VAULT" ]]; then echo -n "%{$reset_color%}" echo -n "%{$fg_bold[yellow]%}" echo -n "[aws-vault: ${AWS_VAULT}]" echo -n "%{$reset_color%}" echo -n " " fi } # PROMPT='${PR_BOLD_WHITE}%* $(printUser)$(printAwsVault)${PR_CYAN}%~%<< $(git_prompt_info)${PR_BOLD_WHITE}>%{${reset_color}%} '