Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: autoload syntax



On Dec 30, 12:11pm, Ray Andrews wrote:
}
} autoload -U compinit
} compinit
} 
} or:
} 
} autoload -U compinit compinit
} 
} or:
} 
} autoload -U compinit ; compinit
} 
} Which of these is the most kosher?

The second one doesn't run compinit, just marks it for autoloading,
so you probably don't want that.  Where did you see this?

The other two are exactly equivalent, entirely up to your preference.

I use

autoload -U compinit &&
    compinit -d ${ZDOTDIR:-$HOME}/.zcompdump-$ZSH_VERSION \
        ${${${ZSH_VERSION%%<4->*}:+-D}:--C}

which maintains a separate compdump file for each version numbered
4 or higher but does not write one at all for any version less, and
skips the check for new functions if a dump file is already there.
This facilitates having an NFS'd home directory on hosts with various
builds of zsh, or testing a dev build on a host with a more stable
version as the default shell.

I suppose nowadays I could throw $ZSH_PATCHLEVEL in there somewhere.

} I get the feeling I could root around in zsh for the next decade and 
} still only have scratched the surface of what you can do with it!

True of a lot of programming languages ...



Messages sorted by: Reverse Date, Date, Thread, Author