[英]Brew Git Bash Completion with zsh
I changed from Mac Port to Homebrew我从 Mac Port 改为 Homebrew
I am using zsh, I installed brew git git-extra and bash-completion.我正在使用 zsh,我安装了 brew git git-extra 和 bash-completion。 i still don't see git auto completion like mac ports used to show it.我仍然没有看到 git 自动完成就像用来显示它的 mac 端口。
好像你需要获得zsh-completions
You need to add the configs to you .zshrc as below 您需要将配置添加到.zshrc,如下所示
zstyle ':completion:*:*:git:*' script
/usr/local/etc/bash_completion.d/git-completion.bash
fpath=(/usr/local/share/zsh/site-functions $fpath)
To make Homebrew's completions available in zsh
, you must get the Homebrew-managed zsh site-functions on your FPATH
before initialising zsh
's completion facility.要使 Homebrew 的完成在zsh
可用,您必须在初始化zsh
的完成工具之前在FPATH
上获取 Homebrew 管理的 zsh 站点功能。 Add the following to your ~/.zshrc
file:将以下内容添加到您的~/.zshrc
文件中:
if type brew &>/dev/null
then
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
autoload -Uz compinit
compinit
fi
Additionally, if you receive “zsh compinit: insecure directories” warnings when attempting to load these completions, you may need to run this:此外,如果您在尝试加载这些完成时收到“zsh compinit:不安全目录”警告,您可能需要运行以下命令:
chmod -R go-w "$(brew --prefix)/share"
Source: https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh来源: https : //docs.brew.sh/Shell-Completion#configuring-completions-in-zsh
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.