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

Re: prompt color pbg ,pfg,pbg_bold,pfg_bold in colors function?



On Aug 18, 12:26pm, Matthias Kopfermann wrote:
}
} For _prompts_ i have to surround every variable with %{ %} which
} does not , aehem, look too nice.

The colors function is meant to be entirely separable from prompts, so
it avoids reference to any prompt formatting strings.

} what do you think? would it be fine to have that with
} wrapped around %{ %} , too so that not everybody has to put
} these around the keys or roll a prompt_colors_array on his
} own?

Another reason I resisted this is that it leads to PS1 values that
contain lots more %{ %} pairs than are often necessary.  E.g., for a
two-line prompt, you can often put the entire first line in a single
pair of %{ ... %}.

On Aug 18,  3:08pm, Frank Terbeck wrote:
}
} I just think that the colors function would load quite a lot of
} redundant information, if these are added as well.

That, too.

} [snip]
} for i in ${(k)fg} ; do pfg[$i]="%{$fg[$i]%}" ; done
} [snap]
} 
} to your .zshrc, but I guess a loadable function would be easier for
} new users.

Perhaps a candidate for adding to the zsh-newuser-install function?

} Maybe it would be helpful to add this to the colors function:
} 
} [snip]
} blink_color="$lc${color[blink]}$rc"
} [snap]

Hrm.  That would imply we ought to have $fg_blink and $fg_no_blink as
associative arrays as well, etc. ... this doesn't scale.  What's really
needed is a function that takes a set of attributes and turns them on
or off, but then you have to use $(...) which is ugly.  Of course even
then you have to maintain your own idea of the screen state, because
what you send to the terminal is "set the attributes to this" not
"change the attributes in this additive/subtractive way".

This seems like something to revisit when we have discipline functions
attached to parameter expansions.



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