diff options
author | Dennis Eriksen <d@ennis.no> | 2024-06-07 15:22:08 +0200 |
---|---|---|
committer | Dennis Eriksen <d@ennis.no> | 2024-06-07 15:22:08 +0200 |
commit | 71628ead28084ba0dc6695432153c5bb2d9e91bc (patch) | |
tree | d7e93bc083709f3501e39a8578de70dcfd28ce72 | |
parent | use emulate zsh with -L and -R instead of setopt (diff) | |
download | adam3-71628ead28084ba0dc6695432153c5bb2d9e91bc.tar.gz |
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
-rw-r--r-- | prompt_adam3_setup | 17 |
1 files 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]} |