zsh-users
 help / color / mirror / code / Atom feed
* Re: color prompt
       [not found] <19991205180334.A25275@uiuc.edu>
@ 1999-12-06  0:51 ` Adam Spiers
  1999-12-06  4:15   ` Matt Garman
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Spiers @ 1999-12-06  0:51 UTC (permalink / raw)
  To: zsh users mailing list; +Cc: garman

Matt Garman (garman@uiuc.edu) wrote:
> Is there any way I can colorize my zsh prompt?
> 
> I've tried several methods of putting ansi escape codes in my PS1
> variable, but I can't get the results I want.

The latest development versions of zsh 3.1.6 have a themeable prompt
system with plenty of (ahem) nice colours.  Even if you don't want to
use a bleeding edge version, the relevant shell-scripts should serve
as examples of how to get colours in your prompt.

For information on where to get the latest development versions, and
very brief instructions on how to use the prompt theme system, see:

  http://www.new.ox.ac.uk/~adam/computing/zsh/

Adam

P.S. Please send non-development questions to the zsh-users list in
future, rather than zsh-workers.  Thanks!


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

* Re: color prompt
  1999-12-06  0:51 ` color prompt Adam Spiers
@ 1999-12-06  4:15   ` Matt Garman
  1999-12-06  5:24     ` Dan Nelson
  1999-12-07  1:13     ` Adam Spiers
  0 siblings, 2 replies; 4+ messages in thread
From: Matt Garman @ 1999-12-06  4:15 UTC (permalink / raw)
  To: zsh users

On Mon, Dec 06, 1999 at 12:51:48AM +0000, Adam Spiers wrote:
> Matt Garman (garman@uiuc.edu) wrote:
> > Is there any way I can colorize my zsh prompt?
> The latest development versions of zsh 3.1.6 have a themeable prompt
> system with plenty of (ahem) nice colours.  Even if you don't want to
> use a bleeding edge version, the relevant shell-scripts should serve
> as examples of how to get colours in your prompt.
> For information on where to get the latest development versions, and
> very brief instructions on how to use the prompt theme system, see:

I have zsh 3.1.6 installed, but I don't have the promptinit function in
my distrib.  Does that mean, then, that there are different versions of
3.1.6?  How do I know which 3.1.6 is the newest in that case?

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.  For instance, if
I'm trying to complete the filename of a file to edit, and I hit tab,
half of my commandline might dissapear (including some of the prompt) --
note that if I ignore the aesthetics, the functionality is still the
same.

Any ideas?

> P.S. Please send non-development questions to the zsh-users list in
> future, rather than zsh-workers.  Thanks!

Sorry, won't happen again!

Thanks,
Matt

-- 
Matt Garman, garman@ews.uiuc.edu
"And through the window in the wall
 Come streaming in on sunlight wings
 A million bright ambassadors of morning." 
	--Pink Floyd, "Echoes"


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

* Re: color prompt
  1999-12-06  4:15   ` Matt Garman
@ 1999-12-06  5:24     ` Dan Nelson
  1999-12-07  1:13     ` Adam Spiers
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Nelson @ 1999-12-06  5:24 UTC (permalink / raw)
  To: zsh users

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@emsphone.com


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

* Re: color prompt
  1999-12-06  4:15   ` Matt Garman
  1999-12-06  5:24     ` Dan Nelson
@ 1999-12-07  1:13     ` Adam Spiers
  1 sibling, 0 replies; 4+ messages in thread
From: Adam Spiers @ 1999-12-07  1:13 UTC (permalink / raw)
  To: zsh users

Matt Garman (garman@uiuc.edu) wrote:
> On Mon, Dec 06, 1999 at 12:51:48AM +0000, Adam Spiers wrote:
> > Matt Garman (garman@uiuc.edu) wrote:
> > > Is there any way I can colorize my zsh prompt?
> > The latest development versions of zsh 3.1.6 have a themeable prompt
> > system with plenty of (ahem) nice colours.  Even if you don't want to
> > use a bleeding edge version, the relevant shell-scripts should serve
> > as examples of how to get colours in your prompt.
> > For information on where to get the latest development versions, and
> > very brief instructions on how to use the prompt theme system, see:
>
> I have zsh 3.1.6 installed, but I don't have the promptinit function in
> my distrib.  Does that mean, then, that there are different versions of
> 3.1.6?  How do I know which 3.1.6 is the newest in that case?

An `echo $ZSH_VERSION' will always give you a clue as to
(approximately) which version you are using.

There are many versions of 3.1.6 floating around:

  3.1.6        -- The last official development version.  There have
                  been many MANY improvements since this; if you don't
                  mind using unstable versions, you might as well reap
                  the many benefits of using one of the versions below
                  instead of this one:

  3.1.6-pws-x  -- Official intermediate development versions compiled
                  by Peter Stephenson (pws) from selected patches from
                  zsh-workers.  Sometimes released once a week,
                  sometimes less often.

  3.1.6-bart-y -- "Intermediate intermediate" releases from Bart
                  Schaefer, to make developer's lives easier while pws
                  was away.

  3.1.6-cvs    -- Public CVS repository maintained by Tanaka Akira.  The
                  intermediate releases above are always merged into
                  the main branch, so this source tree represents the
                  current development tree the closest on average.


If you were to put them on a scale, it would be something like this:


    3.x.y, x even    3.x.y, x odd    intermediate devel      tanaka-cvs
    (e.g. 3.0.7)     (e.g. 3.1.6)    releases (pws, bart)

  <---------------------------------------------------------------------->

    least often released /                          most often released /
    most stable                                     most bleeding edge   


See the URL I mentioned before for where to get these in various formats:

  http://www.new.ox.ac.uk/~adam/computing/zsh/

> In the mean time, I tried putting something like this in my ~/.zshrc file:
>
> fg_black="$(echo -n '\e[1;30m')"

As you'll notice if you look at Functions/Misc/colors from once of the
recent development versions (not 3.1.6 pure), this could be written
as:

  fg_black=$'\e[1;30m'

Your cursor positioning question has already been answered elsewhere.

Adam


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

end of thread, other threads:[~1999-12-07  1:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <19991205180334.A25275@uiuc.edu>
1999-12-06  0:51 ` color prompt Adam Spiers
1999-12-06  4:15   ` Matt Garman
1999-12-06  5:24     ` Dan Nelson
1999-12-07  1:13     ` Adam Spiers

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