zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@u.genie.co.uk>
To: Juhapekka Tolvanen <juhtolv@st.jyu.fi>
Cc: zsh-workers@sunsite.auc.dk
Subject: Re: Good documentation about literal escape sequences in prompt?
Date: Sun, 12 Mar 2000 18:19:39 +0000	[thread overview]
Message-ID: <38CBDFBB.F2917D52@u.genie.co.uk> (raw)
In-Reply-To: <Pine.LNX.4.10.10003121922080.11517-100000@verso.st.jyu.fi>

Juhapekka Tolvanen wrote:
> 
> Well, let's see:
> 
> 1663 | p6 | juhtolv@heresy : /home/juhtolv
> % . /usr/share/zsh/functions/colors
> 1664 | p6 | juhtolv@heresy : /home/juhtolv
> % PS1="%{$fg_bold[red]%}$PS1%{$reset_color%}"
> [red]1665 | p6 | juhtolv@heresy : /home/juhtolv
> %
>
> And whole prompt is now cyan-colored.

I think that's a result of you using a slightly older version of Zsh
than the latest. The colors function has changed so that $fg_bold is an
associative array so for example $fg_bold[red] gives you the element
indexed by 'red'. Have a look in the colors function for a variable
definition for bold red and use that insead of $fg_bold[red] above or do
it directly as follows:

PS1="%{"$'\e[1;31m'"%}$PS1%{"$'\e[0m'"%}"

> When I find some escape sequences from /usr/share/zsh/functions/colors, how
> can I "convert" them so, that I can put them to my PS1 between %{...%} ?

You should be able to take my line above as an example of this.

> At least that question should be answered somewhere in docs. But it would be
> better to list all escape sequences in such format, that can be added to
> PS1 between %{...%}.

The list of escape sequences are not a feature of zsh but of your
terminal emulator. Try looking in the man pages for xterm. The colors
function merely defines zsh variables for command ANSI standard escape
sequences. Admittedly, the zsh docs could use a simple example of a
coloured prompt though.

Oliver Kiddle


  reply	other threads:[~2000-03-12 18:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-11 23:41 Juhapekka Tolvanen
2000-03-11 23:55 ` Adam Spiers
2000-03-12  0:05 ` Bart Schaefer
2000-03-12 17:35   ` Juhapekka Tolvanen
2000-03-12 18:19     ` Oliver Kiddle [this message]
2000-03-12 19:34       ` Juhapekka Tolvanen
2000-03-12 18:37     ` 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=38CBDFBB.F2917D52@u.genie.co.uk \
    --to=opk@u.genie.co.uk \
    --cc=juhtolv@st.jyu.fi \
    --cc=zsh-workers@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).