Reputation: 51
I Want If The Previous succeeded
PROMPT="%F{46}(^v^)%f %F{67}%n%f%F{61}@%f%F{70}%m%f %F{116}in %f%F{65}%~%f%B%F{39} ->%f%b "
If Not
PROMPT="%F{9}(\`O´)%f %F{67}%n%f%F{61}@%f%F{70}%m%f %F{116}in %f%F{65}%~%f%B%F{39} ->%f%b "
Upvotes: 1
Views: 537
Reputation: 532398
zsh
has a conditional escape available to use in prompts. It has the general form
%(x.true.false)
where x
is a single character condition to test, and true
and false
are arbitrary strings that the %(...)
construct will expand to when that condition is true or false, respectively. In your case, the condition character will be ?
, so you can write
PROMPT="%(?.%F{46}(^v^)%f.%F{9}(\`O´)%f) %F{67}..."
Upvotes: 2