Zsh冲泡配方的完成


12

在OS X中,是否可以使用Zsh(我使用的是Oh-my-zsh)制表符完整的公式?

例如

$ brew install em<TAB>

可以扩展为:

$ brew install emacs

Answers:


4

Homebrew提供它自己的完成。您只需要将文件链接$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh_brew您的某个位置即可$fpath。(请参阅https://github.com/Homebrew/homebrew/blob/master/Library/Contributions/brew_zsh_completion.zsh开头的评论)

zsh-completions最近_brew为了支持该文件而删除了它的完成信息,请参阅https://github.com/zsh-users/zsh-completions/issues/305


2016年4月19日更新:在某个时候(1)Homebrew再次更新了其对zsh完成的处理。现在,如果通过Homebrew 安装zsh,它将“正常工作”。该文件已安装到/usr/local/share/zsh/site-functions/_brew


对于任何有兴趣$fpath并愿意在其中$FPATH容纳这些新完成功能的人员 Zsh本问答可能会提供很多信息。
Amelio Vazquez-Reina

12

尝试安装zsh-completions公式。

$ 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

看起来zsh可能与bash补全兼容。您可以将其与bash-completions公式结合使用。


2
compinit -i应该解决“不安全目录”警告而不是chmod。
Thomas Hughes 2015年

对于“不安全目录”错误,用于compaudit确定应更改其权限的目录
user2561747
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.