zsh-workers
 help / color / mirror / code / Atom feed
From: Christian Neukirchen <chneukirchen@gmail.com>
To: zsh-workers@zsh.org
Subject: Re: Outputting colored zsh prompts from an external script
Date: Sun, 24 Mar 2013 22:30:10 +0100	[thread overview]
Message-ID: <87620g32ql.fsf@gmail.com> (raw)
In-Reply-To: <20130324192345.GA20437__22562.4022576541$1364153239$gmane$org@kaeru> (seanh's message of "Sun, 24 Mar 2013 20:23:45 +0100")

seanh <snhmnd@gmail.com> writes:

> I also tried getting zshprompt.py to print out zsh color codes like
> %{$fg[red]%}FOO%{$reset_color%}, but zsh doesn't seem to interpret these
> when they're printed by zshprompt.py, it just prints them out into the
> prompts literally. I tried various zsh options with this, such as
> setopt promptpercent and setopt promptsubst, and tried various other ways of
> calling the Python script, such as within double-quotes or back-ticks
> instead of single-quotes, or without any quotes at all. Nothing worked.

This works here (note how it gets executed every time):

setopt promptsubst
PROMPT+='$(date +"%%F{red}%H:%M:%S%%f") '

Alternatively, you could try setting the prompt in a precmd().

But I expect terrible performance from running a python command before
every prompt.  It does not seem very hard to port that python code there
to plain zsh.

Have fun,
-- 
Christian Neukirchen  <chneukirchen@gmail.com>  http://chneukirchen.org


       reply	other threads:[~2013-03-24 21:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20130324192345.GA20437__22562.4022576541$1364153239$gmane$org@kaeru>
2013-03-24 21:30 ` Christian Neukirchen [this message]
     [not found] <20130324192345.GA20437@kaeru>
     [not found] ` <871ub431wq.fsf@gmail.com>
     [not found]   ` <CAMvu5b+RCigGy-rjtyQB_H_vYF1MPC4PjEW0NBgFYrJEYnViZw__868.462134576653$1364217014$gmane$org@mail.gmail.com>
2013-03-25 15:42     ` Christian Neukirchen

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=87620g32ql.fsf@gmail.com \
    --to=chneukirchen@gmail.com \
    --cc=zsh-workers@zsh.org \
    /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).