开发者

ZSH Prompt/RPrompt Conflict

开发者 https://www.devze.com 2022-12-11 19:28 出处:网络
I currently have my ZSH PROMPT variable set up as: PROMPT=$\'[%{\\e[0;32m%}%n@%m:%~%{\\e[0m%}]> and my RPROMPT variable as:

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

精彩评论

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