~RVM_PROJECT_PATH in oh-my-zsh prompt

瘦欲@ 提交于 2019-12-23 06:57:23

问题


Recently installed .oh-my-zsh on a new machine on which RVM was already installed.

Noticed that in several of my Rails project directories, I now see this instead of the actual name of the project directory:

➜  ~RVM_PROJECT_PATH git:(master) 

All other behavior seems normal, but I'm finding it difficult to pin down the cause in the .oh-my-zsh configuration.


回答1:


it is a bug in your Zsh, to avoid it use %1/ in PROMPT instead of %. or %C or %1~

more info: https://github.com/wayneeseguin/rvm/issues/3091

this bug should be fixed in zsh 5.0.7 ... or with this https://github.com/robbyrussell/oh-my-zsh/pull/3252




回答2:


oh-my-zsh has been updated to fix this issue. Forcing an upgrade of oh-my-zsh fixed the problem for me.

$ source ~/.oh-my-zsh/tools/upgrade.sh



回答3:


So, I was really struggling with this for a while. I'm not using oh-my-zsh, just straight zsh, but had the same issues. Upgraded a lot of stuff. After digging through this huge script and trying lots of suggestions, this finally worked for me:

hash -rd

I just put this before I set my variable holding the directory. My config now looks like this:

30 hash -rd 31 local promptsize=${#${():---(${PR_GEMSET}${PR_BRANCH})---()--}} 32 local pwdsize=${#${(%):-%~}}

Note that the issue was with the %~. Just thought I'd share what worked for me.




回答4:


You can write this on console, my problem is solved.

PROMPT='%F{green}%1/ ${vcs_info_msg_0_}$ '



来源:https://stackoverflow.com/questions/26369548/rvm-project-path-in-oh-my-zsh-prompt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!