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

Re: command substitution with control chars?



On 25/03/07, Atom Smasher <atom@xxxxxxxxxxx> wrote:
i'm trying to have part of a dynamic prompt that displays in different
colors depending on system parameters.

the output of the script starts with some control characters to set the
text colors, then outputs some colored text from a script, then outputs
^[[0m to return to normal colors.

if i run the script in precmd() it ~almost~ works 100%... except that the
end of the prompt may be hosed by tab-expansion or command line editing
(since the control characters aren't properly counted in the width of the
prompt). also, this is limited to only having the output of the script at
the beginning of the line, although for now that is where i want it.

i suspect the better way to do this would be command substitution in the
prompt, but the control chars seem to really be making a mess out of that.
any suggestions?

thanks...

It sounds like you just need to put your escape sequences inside %{ %} pairs?

--
Mikael Magnusson



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