简体   繁体   中英

ZSH `rvm-prompt` on RHS prompt not refreshing

I have rvm-prompt feeding into my RPrompt, however it is not refreshing between commands: rvm-prompt和rprompt不同步 ( Larger image )

For example, when I cd from one ruby project to another with an .rvmrc file pointing to a new gemset, the rprompt simply will not refresh. It appears that it must be caching the rprompt for performance purposes, so I am curious as to how I can force a refresh for zsh at each command?

How do you generate the prompt? I do it like this:

local rvm_ruby=' %{$fg[red]%}[$(~/.rvm/bin/rvm-prompt i v g s)]%{$reset_color%}'

And then use the rvm_ruby variable in my prompt:

PROMPT="${user_host}${directory}${git_branch}${rvm_ruby}%B
→%b "

EDIT: Note that the place where you create the contents for the variable needs single quotes, otherwise the command will get substituted right away and not updated anymore. This initially took me a bit to figure out. You may have the same problem defining your RHS prompt.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM