diff --git a/home/zshrc b/home/zshrc index 6869777..1b89df9 100644 --- a/home/zshrc +++ b/home/zshrc @@ -167,15 +167,30 @@ if [[ "$TERM" = xterm* ]]; then precmd() { print -Pn "\e]2;%M: %~\a" } fi -# note: zsh adds a % symbol to newline-less output, so bash prompt is overkill function { - local good='green' - [[ "$host" == neobanshee ]] && good='cyan' - [[ "$host" == spectre ]] && good='white' - [[ "$host" == wraith ]] && good='yellow' - [[ "$host" == sabotage ]] && good='magenta' - PROMPT='%{'$'\e''[10m%}%b%(?.%K{'"$good"'}.%K{red})%15F%#%f%k ' - RPROMPT='%8F%h%b' + if [[ "$TERM" != xterm* ]] && [[ "$TERM" != screen* ]]; then + PROMPT="%# " + unset RPROMPT + return + fi + + # zsh adds a % symbol to newline-less output, so my bash prompt is overkill + # NOTE: i've started hardcoding escapes instead of relying on zsh + # because detecting terminal features is too troublesome. + local s=$'\x1B\x5B' # start escape code + local e=m # end escape code + local reset="${s}0${e}" + local good=42 # green + local bad=41 # red + + [[ "$host" == neobanshee ]] && good=46 # cyan + [[ "$host" == spectre ]] && good=47 # white + [[ "$host" == wraith ]] && good=43 # yellow + [[ "$host" == sabotage ]] && good=45 # magenta + + # NOTE: i had ${s}10${e} here before, is it still necessary? + PROMPT="%{$reset${s}%(?.${good}.${bad})${e}${s}97${e}%}%#%{$reset%} " + RPROMPT="%{${s}90${e}%}%h%{$reset%}" } TIMEFMT=$'\e[93m%*U/%*E cpu/real (%P), %MM mem:\e[36m %J\e[0m'