#------------------------------------------------------------------- # awesome prompt magicatron #------------------------------------------------------------------- # this is, like, the only way to get a newline local newline=" " function colorprompt { mode=${1:-0} promptstring=( "%{[${mode}m%}[%m:%~]" "%(1j.%{%} (%j jobs).)" "%(?..%{%} (error %?%))" $newline "%{%(!..[${mode}m)%}%n " "%#%{%} " ) # it's like PROMPT=join("", $promptstring) PROMPT=${(j::)promptstring} } function uncolorprompt { local promptstring=( "[%m:%~]" "%(1j. (%j jobs).)" "%(?.. (error %?%))" $newline "%n %# " ) PROMPT=${(j::)promptstring} } if [ -n "$SUDO_USER" ]; then colorprompt '33;1' else colorprompt fi