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

Re: esc seq in prompt



Scott Smedley wrote:
>        red=`print -nP '\e[\033[31;;1m'`

	red=$'\e[31m'

etc.  You have the \e[ part doubled, and it's more efficient to use $''.

>        export PROMPT=$green$MACHINE$color1$errno">"$color2"> "$white

	PROMPT="%{$green%}$MACHINE%{$color1%}$errno>%{$color2%}> %{$white%}"

%{ and %} must surround all parts of the prompt that don't affect the
cursor position.  Otherwise zsh has no idea how much space the prompt
will take up on the screen.

This is addressed in the FAQ, question 3.25.

-zefram



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