我刚刚按照这里的方法安装了rvm以升级ruby。安装后,我的zsh实例现在总是显示rvm:ruby-2.3.0,如下图所示:
。
我希望它不会出现,但我很难找到它设置的地方,有什么想法吗?这相当烦人。
谢谢!
![enter image description here](https://istack.dev59.com/HQvCe.webp)
我希望它不会出现,但我很难找到它设置的地方,有什么想法吗?这相当烦人。
谢谢!
如果你和我一样,因为powerlevel10k
主题出现了问题而来到这里,请按照以下步骤操作:
打开~/.p10k.zsh
找到此行:
rvm # ruby version from rvm (https://rvm.io)
将其注释:
# rvm # ruby version from rvm (https://rvm.io)
打开一个新的终端
.zsh-theme
的文件中,该文件在您的主目录下的.zshrc
文件中指定。.zshrc
文件。您可以在~/.zshrc
中找到.zshrc
文件。当您打开该文件时,您会看到一行类似于这样的内容:ZSH_THEME="gallois"
。(看起来您正在使用gallois)ZSH_THEME="gallois"
更改为ZSH_THEME="dallas"
以切换到预先存在的dallas主题。单击此处查看所有默认主题及其外观的列表。这些主题位于~/.oh-my-zsh/themes
中。. ~/.zshrc
以源化zsh,并查看新提示。~/.oh-my-zsh/themes
中。我建议复制gallois.zsh-theme
文件并创建其他文件,例如yourname.zsh-theme
。在主题文件中,您可以通过删除以下注释下面的行来完全删除右侧提示:# Combine it all into a final right-side prompt
RPS1='$(git_custom_status)$(ruby_prompt_info) $EPS1'
为了保险起见,您可能还应该从主题文件中删除此内容:
# RVM component of prompt
ZSH_THEME_RVM_PROMPT_PREFIX="%{$fg[red]%}["
ZSH_THEME_RVM_PROMPT_SUFFIX="]%{$reset_color%}"
#Customized git status, oh-my-zsh currently does not allow render dirty status before branch
git_custom_status() {
local cb=$(git_current_branch)
if [ -n "$cb" ]; then
echo "$(parse_git_dirty)%{$fg_bold[yellow]%}$(work_in_progress)%{$reset_color%}$ZSH_THEME_GIT_PROMPT_PREFIX$(git_current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi
}
. ~/.zshrc
以源化zsh,然后您将看到新的提示符。~/.oh-my-zsh/themes
中。我建议复制gallois.zsh-theme
文件并创建另一个文件,例如yourname.zsh-theme
。在主题文件中,您可以通过删除此行的一部分来仅删除rvm提示符:# Combine it all into a final right-side prompt
RPS1='$(git_custom_status)$(ruby_prompt_info) $EPS1'
$(ruby_prompt_info)
部分,使其看起来像这样:# Combine it all into a final right-side prompt
RPS1='$(git_custom_status) $EPS1'
然后,您可以跳到最后只删除提示语中的rvm部分。我还建议删除这些行以避免混乱主题文件:
# RVM component of prompt
ZSH_THEME_RVM_PROMPT_PREFIX="%{$fg[red]%}["
ZSH_THEME_RVM_PROMPT_SUFFIX="]%{$reset_color%}"
您需要运行. ~/.zshrc
来启动zsh,然后您就会看到新的提示符。
ruby_prompt_info()
函数,该函数用于确定在提示符中包含什么信息。为此,请编辑您的~/.zshrc
文件,并在源代码$HOME/.rvm/scripts/rvm
之后添加以下内容:# hide ruby version from ps1
function ruby_prompt_info() { echo '' }