From: Sven Guckes <guckes@math.fu-berlin.de>
To: ZShell Users <zsh-users@sunsite.auc.dk>
Subject: color prompts and $' evaluation - zsh-3.1.4 required?
Date: Mon, 27 Mar 2000 20:49:25 +0200 [thread overview]
Message-ID: <20000327204925.A9758@ritz.math.fu-berlin.de> (raw)
The ZSH FAQ from 23rd March 2000 mentions how to set your prompt
to get colors. It says that evaluation with "$'" is required.
I found that this works with zsh-3.1.4 but not with zsh-3.1.2.
I think a note about the required version is needed -
it makes people upgrade, you know. ;-)
Sven
===
3.25: How do I get coloured prompts on my colour xterm?
(Or `color xterm', if you're reading this in black and white.) You need to
find the sequences which generate the various colours from the manual;
these are ANSI standard on the terminal emulators I know about which
support colour. With a recent (post 3.1.6) distribution of zsh, there is a
theme system to handle this for you; even if you don't see that, the
installed function ``colors'' (meaning `colours', if you're not reading
this in black and white) gives the escape sequences. You will end up with
code looking like this (borrowed from Oliver Kiddle):
PS1=$'%{\e[1;31m%}<the rest of your prompt here>%{\e[0m%}'
The `$'' form of quoting turns the ``\e'' into a real escape
character. The ``%{...%}'' is used in prompts for strings which will
not appear as characters, so that the prompt code doesn't miscalculate
the length of the prompt which would have a bad effect on editing.
The resulting ``<ESC>[1;31m'' makes the prompt red, and the ``<ESC>[0m''
puts printing back to normal so that the rest of the line is unchanged.
next reply other threads:[~2000-03-27 18:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-27 18:49 Sven Guckes [this message]
2000-03-27 18:58 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20000327204925.A9758@ritz.math.fu-berlin.de \
--to=guckes@math.fu-berlin.de \
--cc=zsh-users@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).