From 71628ead28084ba0dc6695432153c5bb2d9e91bc Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Fri, 7 Jun 2024 15:22:08 +0200 Subject: Make adam3 more backwards compatible Older versions of zsh (<5.0.6) don't like the ternary %() inside a start-color (%F{}), but will allept it the other way around. Also, zsh <5.1 don't like setting arrays on the same line as local/typeset --- prompt_adam3_setup | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/prompt_adam3_setup b/prompt_adam3_setup index 6da691f..b676971 100644 --- a/prompt_adam3_setup +++ b/prompt_adam3_setup @@ -94,9 +94,9 @@ prompt_adam3_setup () { prom[venv]="%F{$color[venv]}(SUBSTITUTE)%f" # Promptchar (including exitcode) - typeset -g PROMPT_ADAM3_PROMPTCHAR=${PROMPT_ADAM3_PROMPTCHAR:-"%(?..[%F{red}%?%f] )%B%F{%(!.red.$color[char])}%#%f%b "} + typeset -g PROMPT_ADAM3_PROMPTCHAR=${PROMPT_ADAM3_PROMPTCHAR:-"%(?..[%F{red}%?%f] )%B%(!.%F{red}.%F{$color[char]})%#%f%b "} # same as above, but with $ instead of % as promptchar for unprivileged users - #typeset -g PROMPT_ADAM3_PROMPTCHAR='%B%(!.%F{red}#.F{white}$)%f%b ' + #typeset -g PROMPT_ADAM3_PROMPTCHAR='%B%(!.%F{red}#.%F{white}$)%f%b ' # Set some styles for vcs_info zstyle ':vcs_info:*' enable git svn @@ -121,12 +121,13 @@ prompt_adam3_setup () { done # color-combos. fg,bg - local -a colors=( red,black green,black yellow,black blue,black \ - magenta,black cyan,black white,red yellow,red \ - cyan,red black,green blue,green black,yellow \ - blue,yellow white,blue red,blue yellow,blue \ - white,magenta yellow,magenta white,cyan blue,cyan \ - black,white red,white blue,white magenta,white ) + local -a colors + colors=( red,black green,black yellow,black blue,black \ + magenta,black cyan,black white,red yellow,red \ + cyan,red black,green blue,green black,yellow \ + blue,yellow white,blue red,blue yellow,blue \ + white,magenta yellow,magenta white,cyan blue,cyan \ + black,white red,white blue,white magenta,white ) # Select color color[host]=${colors[$hostnum % $#colors + 1]} -- cgit v1.2.3