Shell – How to make RPROMPT in zsh update itself on every enter

environment-variablespromptshellzsh

My RPROMPT is set to display svn info using vcs_info. It reads RPROMPT=${vcs_info_msg_0_}. vcs_info is called using precmd(). However, RPROMPT doesn't update when I change directories. It works only if I invoke the prompt again (either by source ~/.zshrc or prompt ) and doesn't change upon chdir, unless I invoke the prompt again. Is there any way to change this behaviour?

Best Answer

Try putting single quotes around the variable value at assignment to delay evaluation:

RPROMPT='${vcs_info_msg_0_}'
Related Question