Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Supporting %F{...} and %K{...} in Zsh 4.x



On 12/17/23 15:32, Bart Schaefer wrote:
That seems like an awful lot of work to go through for something that doesn't change very often.

I think it changes more often than some think. Particularly the RPROMPT where I have conditional color for ${?}; 0 is -- from memory -- a bright grey on black "[0]", while > 0 is a bright white on bright red "[#]" (where # is the value of ${?}).

Why not just something like:

if [[ "${(%):-"%F{red}%f"}" = *red* ]]
then PROMPT=$'This is an %{\e[31m%}old%{\e[39m%} shell %# '
else PROMPT='This is a %F{red}new%f shell %# '
fi

Because that's two PROMPT values to maintain (independent of the old vs new). I'd rather have one version to maintain and for that version to be relatively easy to read and understand.

I'm pretty sure $'...' works properly in 4.2.5, but the closest I can test with is 4.2.6. In sufficiently old zsh, even the parse of "${(%):-"%F{red}%f"}" doesn't work.

I must be too tired as I'm not able to unpack what that does. It seems as if it does something with "(%)" and uses "%F{red}%f" if the former is unset. But I don't recognize "(%)". :-(

What Roman said RE "export".

ACK

Also there's no reason to re-export a parameter every time you change it. Once exported, always exported, unless "typeset +x" is used.

Noted.

Thank you.

Today I Learned.



--
Grant. . . .

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature



Messages sorted by: Reverse Date, Date, Thread, Author