Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: color prompt
- X-seq: zsh-users 2759
- From: Dan Nelson <dnelson@xxxxxxxxxxxx>
- To: zsh users <zsh-users@xxxxxxxxxxxxxx>
- Subject: Re: color prompt
- Date: Sun, 5 Dec 1999 23:24:40 -0600
- In-reply-to: <19991205221528.A25782@xxxxxxxx>; from "Matt Garman" on Sun Dec 5 22:15:28 GMT 1999
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <19991205180334.A25275@xxxxxxxx> <19991206005148.B9247@xxxxxxxxxxxxxxxxxxxxxxx> <19991205221528.A25782@xxxxxxxx>
In the last episode (Dec 05), Matt Garman said:
> In the mean time, I tried putting something like this in my ~/.zshrc file:
>
> fg_black="$(echo -n '\e[1;30m')"
> fg_green="$(echo -n '\e[0;32m')"
> fg_brown="$(echo -n '\e[0;33m')"
> fg_grey="$(echo -n '\e[0;37m')"
> PS1="${fg_black}[${fg_green}%W %T${fg_black}] \
> ${fg_brown}%m${fg_black}:${fg_brown}%l \
> ${fg_black}:${fg_brown}%~${fg_grey}%# "
>
> (that's all on one line)
>
> Which makes my prompt look exactly the way I want it. However, this
> seems to disturb cursor positioning for doing completions with tab and
> also browsing the command history with the arrow keys.
Zsh expects that every character in PS1 will advance the cursor one
space. Wrap any non-printing escape sequences in %{...%}, and it
should work. So use %{$fg_black%}, etc.
--
Dan Nelson
dnelson@xxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author