我遇到了一些特定 git 命令(涉及远程和分支的命令)的 Zsh 自动完成问题,但仅在使用别名时出现。
这是一个使用push
的例子:
$ git push o<TAB>rigin m<TAB>aster # tab completion works
$ git config --global alias.ps push # set a `ps` alias for `push`
$ git ps o<TAB>rigin m<TAB> # tab completion doesn't work for "master"
pull
和 fetch
也会出现同样的问题。
我的.zshrc
可以找到here ,但我不认为它是相关的,因为我能够在不使用它的情况下重现问题(只需使用 autoload -U compinit && compinit
启用自动完成)。
我正在运行具有以下软件版本的 OSX 10.9(它们都是通过 brew
安装的):
$ zsh --version
zsh 5.0.2 (x86_64-apple-darwin13.0.0)
$ git --version
git version 1.8.4.2
自从我执行 OSX 10.9 全新安装后就出现了这个问题。所以我认为它来自 Zsh 或 Git 的最新更新。
最佳答案
也许你应该使用 Git 官方对 zsh 的补全:
https://git.kernel.org/cgit/git/git.git/tree/contrib/completion/git-completion.zsh
关于macos - Git 别名参数完成在 Zsh 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19771455/