agnoster
主题来设置ZSH
,则可以按照以下步骤禁用git分支信息:
打开agnoster.zsh-theme
主题配置文件 - 例如
vi ~/.oh-my-zsh/themes/agnoster.zsh-theme
在函数build_prompt() { ...}
中,只需注释掉下面这行代码即可
# prompt_git
~/.oh-my-zsh/themes/agnoster.zsh-theme
文件,并注释掉包含单词echo
和branch
的行。echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
echo -n $(hg prompt "☿ {rev}@{branch}") $st
echo -n "☿ $rev@$branch" $st
git_prompt_info
辅助函数。如果将oh-my-zsh.hide-info
git属性设置为1
,此函数将不会将GIT分支信息添加到提示符中。git config --global --add oh-my-zsh.hide-info 1
agnoster
主题不使用 git_prompt_info
,但工作方式类似。它只是期望一个不同的属性,oh-my-zsh.hide-status
。因此,要在 agnoster
主题中禁用 GIT 分支信息,请使用以下内容:git config --global --add oh-my-zsh.hide-status 1
cat ~/.zshrc | grep -i git
将会显示你在配置文件中启用 git 信息的位置。 - LinFelix.oh-my-zsh/themes/agnoster.zsh-theme
中,但似乎使用不同的主题更好。如果只是关于行长度和光标移动距离的问题,您可以使用修改过的主题,比如将光标放在新行上的此主题:https://gist.github.com/nweddle/e456229c0a773c32d37b - denmch