/lzn-auto-require

Auto load optional plugins via lua modules with lz.n

Primary LanguageLuaGNU General Public License v2.0GPL-2.0

lz.n auto require

Overrides require to also search for plugins in {packpath}/*/opt and load them with lz.n

Usage

Place this code somewhere in your config, and call it as late as possible (e.g. at the bottom of your init.lua).

require('lzn-auto-require').enable()

Tip

It's easy to accidentally require a module that you want to lazy-load in your init.lua, which defeats the purpose of lazy loading. Registering the loader as late as possible reduces such mistakes.

After registering the loader, any call to require will also look for the lua module in (packpath)/opt/*/lua.

Nix

The flake is currently only used for development. Please build this plugin normally with buildVimPlugin as shown in nixos wiki

Acknowledgements

Thank you to the lz.n authors for their great work!

Part of the code base uses code from lz.n, also licensed under GPL-2