function spwd { paths=(${(s:/:)PWD}) cur_path='/' cur_short_path='/' for directory in ${paths[@]} do cur_dir='' for (( i=0; i<${#directory}; i++ )); do cur_dir+="${directory:$i:1}" matching=("$cur_path"/"$cur_dir"*/) if [[ ${#matching[@]} -eq 1 ]]; then break fi done cur_short_path+="$cur_dir/" cur_path+="$directory/" done printf %q "${cur_short_path: : -1}" echo } if test "$EUID" -eq 0 then local root_color="%{$fg_bold[red]%}" else local root_color="%{$fg_bold[green]%}" fi local indicator="$root_color$(whoami)%{$fg_bold[black]%}@%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%})$(hostname -s)" PROMPT='${indicator} %{$fg[cyan]%}$(spwd)%{$reset_color%} $(git_prompt_info)' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"