编辑git.zsh,找到git_prompt_info函数: functiongit_prompt_info() { local refif[["$(command git config --get oh-my-zsh.hide-status 2>/dev/null)"!="1"]];thenref=$(command git symbolic-ref HEAD2> /dev/null) ||\if[[ -n $ref ]];thenref=$(command git rev-parse --shortHEAD2> ...
PROMPT+=' %{$fg[yellow]%}$(_fishy_collapsed_wd)%{$reset_color%} $(git_prompt_info)' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[blue]%}git:(%{$fg[yellow]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗" ZSH...
sourcepath/to/zshrc.sh#an example promptPROMPT='%B%m%~%b$(git_super_status) %#' Go in a git repository and test it! There is now a Haskell implementation as well, which can be four to six times faster than the Python one. The reason is not that Haskell is faster in itself (alth...
这两个是带有git prompt的主题,安装后进入git仓库目录,效果如下: 笔者选择它的原因在于可以直观看到当前的分支名称,可以看到仓库的状态:有几个文件没有追踪,添加了几个文件,改动了几个文件。 如果是很大的项目,在进入项目时会比较费时,这时可以禁止oh-my-zsh读取git status:git config --add oh-my-zsh.hide-...
➜ /Users/yxibng/Desktop cd Audio-mac ➜ /Users/yxibng/Desktop/Audio-mac git:(master) 方法, 打开 ➜~/.oh-my-zsh/themes/robbyrussell.zsh-theme 将%c替换为%d PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'PROMPT+=' %{$fg[cyan]%}%d%{$reset_color%} $(...
# # See also lib/bzr.zsh, lib/git.zsh and lib/nvm.zsh for # git_prompt_info, bzr_prompt_info and nvm_prompt_info # Dummy implementations that return false to prevent command_not_found # errors with themes, that implement these functions # Real implementations will be used when the ...
比起vcs_info 而言,你可能更偏好提供了 Git 的命令提示符定制脚本 git-prompt.sh;更多信息见 https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh。 git-prompt.sh 同时兼容 Bash 和 Zsh。Zsh 本身已足够强大,但还有一些专门为它打造的完整框架,使它更加完善。其中之一名为 "oh-my-...
PROMPT='%{$fg_bold[red]%}-> %{$fg_bold[magenta]%}%n%{$fg_bold[cyan]%}@%{$fg[green]%}%m %{$fg_bold[green]%}%p%{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$fg[magenta]%}%(?..%?%1v)%{$fg_bold[blue]%}? %{$fg[yellow]%}#...
# 显示git分支名称 autoload -Uz vcs_info precmd() { vcs_info } zstyle ':vcs_info:git:*' formats '(%b)' setopt PROMPT_SUBST PS1='...%(4V.%F{red}.)$vcs_info_msg_0_' 保存并退出配置文件,然后在终端中执行以下命令使配置生效: 代码语言:txt 复制 source ~/.zshrc 现在,当你进入一个git...
and it can be found athttps://github.com/robbyrussell/oh-my-zsh. oh-my-zsh’s plugin system comes with powerful git tab-completion, and it has a variety of prompt "themes", many of which display version-control data.An example of an oh-my-zsh theme.is just one example of what can...