Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Supporting %F{...} and %K{...} in Zsh 4.x
On Tue, Dec 19, 2023 at 10:00 PM Grant Taylor
<gtaylor@xxxxxxxxxxxxxxxxxx> wrote:
>
> 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
So what are you planning to do, re-source your .zshrc every time it changes?
The plan to translate %F / %K just seems unworkable to me.
> 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 ${?}).
OK, but you do that with the %(?.true.false) escape, right? You're
not changing the actual assignment to PROMPT= every time? The latter
is what I mean by "doesn't change very often" (if you're using nothing
but 4.2 features).
> > if [[ "${(%):-"%F{red}%f"}" = *red* ]]
>
> I must be too tired as I'm not able to unpack what that does.
(%) is a parameter expansion flag, it means "treat the rest of this
expansion like a prompt".
Using :- like that means "if the empty parameter name is unset" (which
is always the case).
So if %F is not supported in a prompt, that substitution will return
something containing the literal string "red" somewhere.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author