zsh-users
 help / color / mirror / code / Atom feed
* color prompts and $' evaluation - zsh-3.1.4 required?
@ 2000-03-27 18:49 Sven Guckes
  2000-03-27 18:58 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Guckes @ 2000-03-27 18:49 UTC (permalink / raw)
  To: ZShell Users

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: color prompts and $' evaluation - zsh-3.1.4 required?
  2000-03-27 18:49 color prompts and $' evaluation - zsh-3.1.4 required? Sven Guckes
@ 2000-03-27 18:58 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2000-03-27 18:58 UTC (permalink / raw)
  To: ZShell Users

On Mar 27,  8:49pm, Sven Guckes wrote:
> Subject: color prompts and $' evaluation - zsh-3.1.4 required?
> 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.

It doesn't work with 3.0.x either, obviously ... for those versions
you can use $(print ...) instead.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-03-27 18:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-27 18:49 color prompts and $' evaluation - zsh-3.1.4 required? Sven Guckes
2000-03-27 18:58 ` Bart Schaefer

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).