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

Re: zmodload zmv ?

On 2002-03-20 at 10:29 +1100, Nick Croft wrote:
> zmv looks to be a very handy utility. With Debian, it's located
> under /usr/share/zsh/4.0.4/functions/Misc  .
> I've tried starting it with zmodload zmv - nothing.

zmodload is for loading dynamic code into zsh.  For your platform, ".so"

"man zshmodules"

> I've moved, chowned, and chmodded it to a local fpath.

fpath/FPATH is searched for an undefined (-u) function; see zshparam(1).
To create such a function, use the autoload builtin; see zshbuiltins(1).

> What's the trick? All the googling points to the same paragraph being
> quoted. The source contains a pretty good description of its uses but no
> hint as to startup.

There are some example startup files which ship with zsh; you'll need to
check your package to see if they were included.

The example zshrc includes:

-----------------------------< cut here >-------------------------------
# Where to look for autoloaded function definitions
fpath=($fpath ~/.zfunc)

# Autoload all shell functions from all directories in $fpath (following
# symlinks) that have the executable bit on (the executable bit is not
# necessary, but gives you an easy way to stop the autoloading of a
# particular shell function). $fpath should not be empty for this to
# work.
for func in $^fpath/*(N-.x:t); autoload $func
-----------------------------< cut here >-------------------------------

For comparison, dating back a while, I have:
 autoload ${^fpath}/*(N:t)
and mine is broken.  I thought that I had the executable check in;
obviously I lost it at some point in the past few years.  Oops!

Someone else might be able to explain why it's better to loop over the
expanded list, autoload'ing each, rather than "autoload glob".
"Reading my work email is a nice break from the nasty sunshine" - Carel

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