4

我正在使用 vcs_info 在提示符中添加有关 git 的信息。我已经配置:

setopt promptsubst                
autoload -Uz vcs_info             
zstyle ':vcs_info:*' enable git   
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' stagedstr '!'
zstyle ':vcs_info:*' unstagedstr '?'                                           
zstyle ':vcs_info:*' formats '[%b]%c%u'
...
PROMPT='${vcs_info_msg_0_}$ '

现在,我有一个带有当前更改的 git 存储库,即一个暂存和未暂存文件:

# On branch test
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file:   a
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       b

但是,我的提示是忽略未暂存的文件并仅显示!对于上演的。它看起来如下:

[test]!$

要么我误解了 %u 应该输出什么,要么我必须在某处有错字。我在 zsh 4.3.17 上。

4

1 回答 1

4

我认为您的 .zshrc 可能还可以。

您的存储库文件“a”已暂存。所以 zsh 显示“!” 按预期提示它。但文件“b”只是未跟踪。未跟踪!=未上演。所以, ”?” 未显示。

于 2012-08-06T00:08:27.337 回答