zsh完成差异

我看到很多人这样做

autoload -Uz compinit

compinit

和其他人这样做

autoload -U compinit

compinit -i

我想知道这个区别.我应该使用哪一个?

解决方法

自动加载,从
man zshbuiltins

The flags -z and -k mark the function to be autoloaded in native or ksh emulation,as if the option KSH_AUTOLOAD were unset or were set,respectively.

-U标志可以追溯到:autoload等效于功能-u,这相当于排版-f.简而言之,排版用于:

Set or display attributes and values for shell parameters.

当-f与-U组合使用时:

[The -f flag causes] The names refer to functions rather than parameters. … The -u and -U flags cause the function to be marked for autoloading; -U also causes alias expansion to be suppressed when the function is loaded.

compinit是compsys使用的完成初始化函数,“较新的”Z-Shell完成系统.详见man zshcompsys.

-i标志用于:

to make compinit silently ignore all insecure files and directories use the option -i

一般来说,您应该使用autoload -Uz,根据this interesting read.

dawei

【声明】:丽水站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

相关文章