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

Re: source ~/dir/*.zsh



Am 22.06.2012 02:01, schrieb TJ Luoma:
> I have split my .zshenv into a bunch of different files which all end
> with different suffixes. For example, functions are called "foo.f.zsh"
> or "bar.f.zsh"
>
> My idea was to put them all into a special directory and then source
> them like so in ~/.zshenv
> 
>       source ~/dir/*.f.zsh

A file bla.f.zsh contains exactly the function
bla ()
{
   # bla_content
}
?

If so: just put all functions in a single dir (say ~/.zsh/functions/).
And there into a file 'bla' you put just "# bla_content", i.e. you omit
the function definition.

Then via

typeset -U path fpath

fpath=(~/.zsh/functions $fpath)

# load all things in there
autoload ${fpath[1]}/*(:t)

you have all you wanted :)

Sorry, if this description is confusing -- see here [1] for the official
documentation on this feature.

- René

[1] http://zsh.sourceforge.net/Doc/Release/Functions.html



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