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

Re: Outputting colored zsh prompts from an external script



seanh <snhmnd@xxxxxxxxx> 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@xxxxxxxxx>  http://chneukirchen.org



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