开发者

ZSH Prompt/RPrompt Conflict

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 gre开发者_开发问答en. 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?


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]>'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜