function my_git_prompt() { tester=$(git rev-parse --git-dir 2> /dev/null) || return INDEX=$(git status --porcelain 2> /dev/null) STATUS="" # is branch ahead? if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" fi # is anything staged? if $(echo "$INDEX" | grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED" fi # is anything unstaged? if $(echo "$INDEX" | grep -E -e '^[ MARC][MD] ' &> /dev/null); then STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" fi # is anything untracked? if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" fi # is anything unmerged? if $(echo "$INDEX" | grep -E -e '^(A[AU]|D[DU]|U[ADU]) ' &> /dev/null); then STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" fi if [[ -n $STATUS ]]; then STATUS=" $STATUS" fi echo "$ZSH_THEME_GIT_PROMPT_PREFIX%{$fg_bold[red]%}$(my_current_branch)%{$reset_color%}$STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX" } function my_current_branch() { echo $(current_branch || echo "(no branch)") } function ssh_connection() { if [[ -n $SSH_CONNECTION ]]; then echo "%{$fg_bold[red]%}(ssh)%{$reset_color%} " fi } PROMPT='%{$fg[yellow]%}λ $(ssh_connection)%{$fg[green]%}%~ $(my_git_prompt)%{$reset_color%}%{$fg[yellow]%}→ %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}| " ZSH_THEME_GIT_PROMPT_SUFFIX=" " ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[magenta]%}↑" ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●" ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[red]%}●" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[white]%}●" ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[red]%}✕"