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

readability (was: Re: prompt color pbg ,pfg,pbg_bold,pfg_bold in colors function?)



On Fri, Aug 18, 2006 at 11:03:51AM -0700, Bart Schaefer:
> 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.

yes, i see that is not a good idea then.

> 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 %{ ... %}.

if one only uses one color , you mean?
perhaps i was mistaken to think that every escape code needs
needs these %{ %} around it.
so i thought it really had to be done  with any new one.

> } [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?

That wouuld really be nice!

The biggest problem in zsh functions is readability
already. As much as i love zsh features and what pleasure
they bring to console life i think that these already come
with a very big cost: and that is very bad readability.
Nearly every line in /usr/share/zsh/*/functions is so
stuffed that it needs much concentration to understand what
it's doing. So much, that i sometimes think of using m4 to
use zsh features in shell programming and that is extremely alarming!
[ And does not at all help in reading other code ]

And prompt definitions belong in this category, too.

                Matthias



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