X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/56f123cdddbb302d253edf610c98725be8aa43d6..329028dafb18a2e56c4fc9f7d98ed014121bbb27:/zsh/lib/prompt.zsh diff --git a/zsh/lib/prompt.zsh b/zsh/lib/prompt.zsh index 92b63a0..a1be82b 100644 --- a/zsh/lib/prompt.zsh +++ b/zsh/lib/prompt.zsh @@ -2,15 +2,19 @@ setopt prompt_subst autoload colors; colors; -hostcolor=green +hostcolor=cyan [[ $(hostname) == "tardis" ]] && hostcolor=red precmd() { - PROMPT='%T $(virtualenv_prompt)%n@%{$fg[$hostcolor]%}%m%(1j. $fg_bold[white]↵%{$fg_bold[red]%}%j.)%{$reset_color%}%-0>..>$(git_prompt_status)%>> + PROMPT='%T $(virtualenv_prompt)%n@%{$fg[$hostcolor]%}%m$(jobs_prompt)%-0>..>$(git_prompt_status)%>> %(?..%{$fg_bold[white]%}%?)%{$reset_color%}$(vi_prompt_info)%{%(!.$fg[red]❰.$fg[green]❱)%1G%} ' RPROMPT='%{$fg[green]%}%~%{$reset_color%}' } +jobs_prompt() { + printf '%s' "%(1j. $fg_bold[white]↵%{$fg_bold[red]%}%j.)%{$reset_color%}" +} + vi_prompt_info() { local vicmd="$fg_bold[green]❰$reset_color%1G" local viins="$fg_bold[blue]❱$reset_color%1G" @@ -78,6 +82,13 @@ git_prompt_status() { (( behind > 0 )) && upstream_str+="%{$fg[blue]%} <$behind" git_status+="$upstream_str" + # Format push + push_ab=( $(git rev-list --left-right --count @...@{push} 2>/dev/null) ) + if (( $? == 0 )); then + (( push_ab[1] > 0 )) && git_status+="%{$fg_bold[blue]%} ⮝$push_ab[1]" + (( push_ab[2] > 0 )) && git_status+="%{$fg_bold[blue]%} ⮟$push_ab[2]" + fi + # Format stashed stashed=$(git stash list | wc -l) if (( stashed > 0 )) then