Yes, you do see the recommendation for -U
often, usually paired with -z
. It’s not documented in the run-help
for autoload
, but there is a section titled “AUTOLOADING FUNCTIONS” in the manpage for zshmisc
.
There it states:
The usual alias expansion during reading will be suppressed if the autoload
builtin or its equivalent is given the option -U. This is recommended for the
use of functions supplied with the zsh distribution. Note that for functions
precompiled with the zcompile builtin command the flag -U must be provided
when the .zwc file is created, as the corresponding information is compiled
into the latter.
I read that as “disregard aliases”. The -z
seems to be to avoid Ksh-isms. I just memorize -Uz
and usually add them to any autoload. Maybe a worthwhile alias: alias al=’autoload -Uz’
.
See also: https://stackoverflow.com/questions/12570749/zsh-completion-difference