例如,当尝试完成 git difftool --cached 时,ZSH 应该直接完成,但是它却给我提供了许多简短的选项供我选择,我做错了吗?我当前的配置如下所示:https://github.com/sblask/dotfiles/blob/master/zshrc.dotfile
例子:
$ git difftool --cac<TAB>
-0 -- omit diff output for unmerged entries
-1 -- diff against "base" version
-2 -- diff against "our branch" version
-3 -- diff against "their branch" version
-b -- ignore changes in amount of white space
-B -- break complete rewrite changes into pairs of given size
-C -- detect copies as well as renames with given scope
--cached -- show diff between index and named commit/
...
答案1
如果你比较一下zsh-5.0.5到zsh-5.0.7,有很多变化git完成:
$ git diff --stat zsh-5.0.5..zsh-5.0.7 | grep _git
Completion/Unix/Command/_git | 353 +++--
Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 158 ++-
发行说明仅提及最重要的更改,但并未提及每个代码更改。以下是提及的提交消息git(我没有深入研究哪些与你的问题相关......):
33180: _git: add missing --3way option
33177: _git: fix typo in git-apply
33178: _git: updates for Git 2.1.0
33176: _git: Add missing --list to git-tag
33179: _git: updates for Git 2.0.0
33184: vcs_info git: consider patches for rebase
33188: vcs_info git: set rrn before using it
33150: completion git: fix send-email --confirm values
33145: vcs_info git: fix applied-string name
33147: vcs_info git: detect revert or cherry-pick with multiple commits
33151: completion git: support aliases when \n exist
33047: use git to simplify massively source distribution file selection
32662: vcs_info git: Fix stagedstr for empty repos
32597: vcs_info git: Describe detached heads symbolically.
32502: fix typo in argument list for git completio
32398: _git: completion updates up to latest git v1.9.0
32397: _git: fix __git_submodules to only use the actual name of the submodule
32395: _git: diff: refactor and fix wrong completions
32396: _git: fix __git_committish_range_{first,last} and __git_is_committish_range
我能够重现你描述的行为zsh-5.0.5,但zsh-5.0.7 git difftool --cac<TAB>
按预期完成git difftool --cached
。
长话短说:将您的安装升级到 zsh-5.0.7。