# zsh theme by Andrew Lorimer # Prompt: # %F => Color codes # %f => Reset color # %~ => Current path # %(x.true.false) => Specifies a ternary expression # ! => True if the shell is running with root privileges # ? => True if the exit status of the last command was success # # Git: # %a => Current action (rebase/merge) # %b => Current branch (hide if master) # %c => Staged changes # %u => Unstaged changes # # Terminal: # \n => Newline/Line Feed (LF) setopt PROMPT_SUBST autoload -U add-zsh-hook autoload -Uz vcs_info # Use 256 colours if available if [[ "${terminfo[colors]}" -ge 256 ]]; then color0="%F{107}" # blue context/angle bracket color1="%F{256}" # white pwd text color2="%F{245}" # grey git branch text color3="%F{167}" # red error/untracked color4="%F{209}" # orange warning/unstaged/suspended color5="%F{107}" # green success/staged else # Fall back to standard ANSI names color0="%F{blue}" color1="%F{white}" color2="%F{cyan}" color3="%F{red}" color4="%F{yellow}" color5="%F{green}" fi reset="%{%f%}" FMT_VCS_STATUS="%{$color2%}%b%u%c%{%f%} " zstyle ':vcs_info:*' enable git zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' unstagedstr "%{%f%} %{$color4%}●" zstyle ':vcs_info:*' stagedstr "%{%f%} %{$color5%}✚" zstyle ':vcs_info:*' actionformats "(%{$color5%}%a%{%f%})${FMT_VCS_STATUS}" zstyle ':vcs_info:*' formats "${FMT_VCS_STATUS}" zstyle ':vcs_info:*' nvcsformats "" # return nothing when no VCS in pwd zstyle ':vcs_info:git*+set-message:*' hooks git-untracked # Check for untracked files +vi-git-untracked() { if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \ git status --porcelain | grep --max-count=1 '^??' &> /dev/null; then hook_com[staged]+="%{%f%} %{$color3%}●" fi } add-zsh-hook precmd vcs_info # Context (user@host) if [[ "$SSH_CLIENT" ]]; then #context="%{$color0%}%n@%m " context='%{$color0%}%n@%m%f ' fi # Check for suspended processes checkjobs() { [[ $(jobs -l | wc -l) -gt 0 ]] && echo "%{$color4%}● " } PROMPT='%1(j.'$color4'● .)'$context'%~ ${vcs_info_msg_0_//master/} %(?.'$color0'.'$color3')%(!.#.❯)%f '