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

Re: Shell startup, aliases vs. functions vs. autoloadable functions, and zcompile benefits



On Tue, Nov 30, 2021 at 5:38 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Tue, Nov 30, 2021 at 7:10 AM Zach Riggle <zachriggle@xxxxxxxxx> wrote:
> >
> > Fortunately, you can redefine "source" as a function and trap all calls and measure how long it takes to load each file.
>
> If you redefine "source" as a function, then any "typeset" commands in
> the sourced files take on the semantics of "local" and the parameters
> are created only in the context of the function wrapper.  That may not
> have any significant effect on benchmarking, but for example settings
> from syntax-highlighting/init.zsh might not be visible to
> syntax-highlighting/external/zsh-syntax-highlighting.zsh (if that
> matters).

All decent plugins (including zsh-syntax-highlighting) can be sourced
from functions because that's how many plugins managers (including
prezto) source them.

Roman.




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