Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: color prompt

On Mon, Dec 06, 1999 at 12:51:48AM +0000, Adam Spiers wrote:
> Matt Garman (garman@xxxxxxxx) 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

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!


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

Messages sorted by: Reverse Date, Date, Thread, Author