R – ZSH Prompt/RPrompt Conflict

promptzsh

I currently have my ZSH PROMPT variable set up as:
PROMPT=$'[%{\e[0;32m%}%n@%m:%~%{\e[0m%}]>

and my RPROMPT variable as:
RPROMPT=$'[%{\e[0;32m%}%T\e[0m%}]'

The effect I'm working for is to make the brackets and ">" white (using Terminal text-color settings) and everything inside of those green. However, when RPrompt is enabled in OS X (Ubuntu works fine), text entry begins 3 characters INTO the LPrompt, and overwrites the last 3 characters!!

Screenshot http://img41.imageshack.us/img41/4575/screenshot20091112at722.png

What is the proper way to color my ZSH Prompt and RPrompt to avoid this issue?

Best Answer

Your RPROMPT messes up for me on Ubuntu. Since zsh knows ANSI color sequences and has its own facility for that (which automatically takes care of zero-width correction, too), try this:

RPROMPT='[%F{green}%T%f]'

And, by the way:

PROMPT='[%F{green}%n@%m:%~%f]>'
Related Topic