Jawaban:
Homebrew menyediakan penyelesaian sendiri. Anda hanya perlu menautkan file tersebut $(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh
ke _brew
suatu tempat di file Anda $fpath
. (Lihat komentar di awal https://github.com/Homebrew/homebrew/blob/master/Library/Contributions/brew_zsh_completion.zsh )
zsh-completions
baru-baru ini menghapus _brew
penyelesaiannya demi file itu, lihat https://github.com/zsh-users/zsh-completions/issues/305 .
Pembaruan 2016-04-19: Pada titik tertentu ( 1 ) Homebrew memperbarui penanganan penyelesaian zsh lagi. Sekarang jika Anda menginstal zsh melalui Homebrew, itu seharusnya "berfungsi". File diinstal ke /usr/local/share/zsh/site-functions/_brew
.
Coba pasang zsh-completions
formula.
$ brew info zsh-completions
zsh-completions: stable 0.10.0, HEAD
https://github.com/zsh-users/zsh-completions
Not installed
From: https://github.com/Homebrew/homebrew/commits/master/Library/Formula/zsh-completions.rb
==> Caveats
To activate these completions, add the following to your .zshrc:
fpath=(/usr/local/share/zsh-completions $fpath)
You may also need to force rebuild `zcompdump`:
rm -f ~/.zcompdump; compinit
Additionally, if you receive "zsh compinit: insecure directories" warnings when attempting
to load these completions, you may need to run this:
chmod go-w /usr/local/share
Sepertinya zsh memiliki kompatibilitas dengan bash . Anda bisa mencobanya bersamaan dengan bash-completions
formula.
compinit -i
harus menyelesaikan peringatan "direktori tidak aman" daripada chmod.
compaudit
untuk menentukan direktori mana yang harus diubah izinnya
$fpath
dan$FPATH
untuk mengakomodasi fungsi penyelesaian baru iniZsh
, T&J ini mungkin informatif.