I have seen many do thisautoload -Uz compinit
compinit
and others do thisautoload -U compinit
compinit -i
I would like to know the difference. which one should I use?
`Completion' is where you hit a particular command key (TAB is the standard one) and the shell tries to guess the word you are typing and finish it for you --- a godsend for long file names, in particular, but in zsh there are many, many more possibilities than that.
Installing Zsh Completions Your completion script must have the following filename format: _example . Next, create a directory at ~/. zsh/completion and copy the completion script to the new directory.
Zsh can handle bash completions functions. The latest development version of zsh has a function bashcompinit, that when run will allow zsh to read bash completion specifications and functions. This is documented in the zshcompsys man page. To use it all you need to do is run bashcompinit at any time after compinit.
zsh-autocomplete adds real-time type-ahead autocompletion to Zsh. Find as you type, then press Tab to insert the top completion, Shift Tab to insert the bottom one, or ↓ / PgDn to select another completion. Enjoy using this software?
autoload
, from man zshbuiltins
:
The flags
-z
and-k
mark the function to be autoloaded in native or ksh emulation, as if the optionKSH_AUTOLOAD
were unset or were set, respectively.
The -U
flag can be traced back: autoload
is equivalent to function -u
, which is equivalent to typeset -f
. typeset
, in a nutshell, is used to:
Set or display attributes and values for shell parameters.
When -f
is used in combination with -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
is the completion initialization function used by compsys
, the 'newer' Z-Shell completion system. See man zshcompsys
for details.
The -i
flag is used to:
to make compinit silently ignore all insecure files and directories use the option -i
In general, you should be using autoload -Uz
, according to this interesting read.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With