Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: readability (was: Re: prompt color pbg ,pfg,pbg_bold,pfg_bold in colors function?)
- X-seq: zsh-workers 22632
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh-Workers <zsh-workers@xxxxxxxxxx>
- Subject: Re: readability (was: Re: prompt color pbg ,pfg,pbg_bold,pfg_bold in colors function?)
- Date: Sat, 19 Aug 2006 11:39:25 -0700
- In-reply-to: <20060819064335.GA13552@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20060818102602.GA24702@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <20060818130849.GD15840@xxxxxxxxxxxxxxx> <060818110351.ZM24330@xxxxxxxxxxxxxxxxxxxxxx> <20060819064335.GA13552@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
On Aug 19, 8:43am, Matthias Kopfermann wrote:
}
} > 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?
No; if you have a two-line prompt. The first line of the prompt makes
no difference at all to the length of the line where zle will be editing,
so you can do
PS1=$'%{whole first line with all sorts of color changes\n%}nextline% '
In fact now that I think of it zle may be smart enough to ignore all
the stuff before the newline, in which case you don't need the %{ %}
at all on that line.
} 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.
Think of it in terms of cursor motion. You need %{ when the cursor
stops moving and %} when it starts again, and in between you can do
anything you like (including sending the cursor off to some other
part of the screen, as long as you bring it back to the original spot
again before closing the braces). You also need %{ and %} only as
they affect the same screen line where the prompt finally finishes,
because zle only cares about horizontal position, not vertical.
} The biggest problem in zsh functions is readability
You mean in cryptic sytax for parameter expansions and format strings.
Yes, in many ways shells are a throwback to the days when the number
of bytes or keystrokes used made a large difference, and interpreters
could not compile and call user-defined functions for things like
prompts and string manipulation. Also the requirement for using the
unix stdin/stdout pipe model for text manipulation made it much more
efficient to build things into the shell syntax that would have been
better handled externally.
- References:
- prompt color pbg ,pfg,pbg_bold,pfg_bold in colors function?
- From: Matthias Kopfermann
- Re: prompt color pbg ,pfg,pbg_bold,pfg_bold in colors function?
- Re: prompt color pbg ,pfg,pbg_bold,pfg_bold in colors function?
- readability (was: Re: prompt color pbg ,pfg,pbg_bold,pfg_bold in colors function?)
- From: Matthias Kopfermann
Messages sorted by:
Reverse Date,
Date,
Thread,
Author