zsh-workers
 help / color / mirror / code / Atom feed
From: Juhapekka Tolvanen <juhtolv@st.jyu.fi>
To: Bart Schaefer <schaefer@candle.brasslantern.com>
Cc: zsh-workers@sunsite.auc.dk
Subject: Re: Good documentation about literal escape sequences in prompt?
Date: Sun, 12 Mar 2000 19:35:29 +0200 (EET)	[thread overview]
Message-ID: <Pine.LNX.4.10.10003121922080.11517-100000@verso.st.jyu.fi> (raw)
In-Reply-To: <1000312000522.ZM26743@candle.brasslantern.com>


On Sun, 12 Mar 2000, Bart Schaefer wrote:

> On Mar 12,  1:41am, Juhapekka Tolvanen wrote:
> } Subject: Good documentation about literal escape sequences in prompt?
> }
> } %{...%}
> }         Include a string as a literal escape sequence. The
> }         string within the braces should not change the cursor
> }         position. Brace pairs can nest.
> } 
> } Hey, come on! Do you really think that is enough? Why don't you provide some
> } good examples? I know you can do it better!
> 
> It's an acknowledged problem that the docs need more examples.  Care to
> provide any?

I can't write documentation about things i can't do myself. Can you?
 
> } For example this does not work:
> } 
> } PS1="%{\e[1;31m%}$PS1%{\e[1m%}"
>          ^^^^^^^^
> The doc says LITERAL escape sequence; the substring \e is not LITERALLY the
> character with ASCII value decimal-27.  What other part of the doc gave you
> the idea that prompting would replace \e with something else?

Why docs does not tell, what those so called literal escape sequences mean
and how they they differ from other kind of escape sequences?
 
> } Color-codes were found from /usr/share/zsh/functions/colors
> 
> Well, then.  What you want to do is (1) run that function `colors' to set
> up the $fg_bold array, etc., and then (2) set your prompt like this:
> 
> PS1="%{$fg_bold[red]%}$PS1%{$reset_color%}"

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 tried to understand other files in /usr/share/zsh/functions, like _prompt
> } and promptinit but even it was the real pain in the ass.
> 
> It's also true that there's no doc for the prompts stuff yet.  You type
> 
> autoload -U promptinit
> promptinit
> 
> And then you can get a little bit of help from `prompt -h'.

I can use those commands and I can load those pre-determined prompts, but
that is not exactly the thing I want to do. I just want to add some escape
sequences to my PS1 so i can add some colors to it.

The biggest unanswered question that still remains is this:

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 %{...%} ?

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 %{...%}.

-- 
-- Juhapekka "naula" Tolvanen * * * U of Jyväskylä * * juhtolv@st.jyu.fi --
-- http://www.cc.jyu.fi/~juhtolv/ * * * * " STRAIGHT BUT NOT NARROW !! " --
---------------------------------------------------------------------------
"I don't want to run a company. I'm not good at managing people. You have
a problem with the guy in the next cubicle? I don't care. Shoot him or
something." Marc Andreessen, founder of Netscape, in Rolling Stone, May '97


  reply	other threads:[~2000-03-12 17:36 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 [this message]
2000-03-12 18:19     ` Oliver Kiddle
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=Pine.LNX.4.10.10003121922080.11517-100000@verso.st.jyu.fi \
    --to=juhtolv@st.jyu.fi \
    --cc=schaefer@candle.brasslantern.com \
    --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).