zsh-completions
1.1、zsh-completions简介
是什么 ?:additional completion definitions for zsh
开发语言:zsh
源码仓库:https://github.com/zsh-users/zsh-completions
1.2、在macOS中安装zsh-completions

step1、通过HomeBrew安装zsh-completions

brew install zsh-completions

step2、在~/.zshrc中添加如下配置

fpath=(/usr/local/share/zsh-completions $fpath)

step3、使配置生效

source ~/.zshrc

step4、删除~/.zcompdump文件

rm -f ~/.zcompdump

step5、重新生成~/.zcompdump文件

compinit

注意:执行compinit命令的时候,可能回提示如下警告:

zsh compinit: insecure directories

这是权限造成的,执行如下的命令,然后再重新执行compinit命令即可。

chmod go-w '/usr/local/share'

这个命令的意思是修改/usr/local/share文件夹的权限,使得此文件夹对组成员用户和其他用户不可写。

1.3、Oh My Zsh用户安装zsh-completions

step1、通过git下载zsh-completions源代码

git clone https://github.com/zsh-users/zsh-completions.git ~/.oh-my-zsh/custom/plugins/zsh-completions

step2、在~/.zshrc中添加如下配置

plugins=( [plugins...] zsh-completions)
autoload -U compinit && compinit

step3、使配置生效

source ~/.zshrc