Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tjdevries/lazy-require.nvim

Require as little as possible. Do as little work as possible. Spend hours shaving off milliseconds
https://github.com/tjdevries/lazy-require.nvim

Last synced: 18 days ago
JSON representation

Require as little as possible. Do as little work as possible. Spend hours shaving off milliseconds

Awesome Lists containing this project

README

        

# lazy.nvim

Require as little as possible. Do as little work as possible. Spend hours shaving off milliseconds

See `:help lazy`

```
================================================================================
*lazy*

Lazy.nvim is a set of helper functions to make requiring modules easier.

Feel free to just copy and paste these functions out or just add as a
dependency for your plugin / configuration.

Hope you enjoy (and if you have other kinds of lazy loading you'd like to see,
feel free to submit some issues. Metatables can do many fun things).

Source:
- https://github.com/tjdevries/lazy.nvim

Support:
- https://github.com/sponsors/tjdevries

lazy.require_on_index() *lazy.require_on_index()*
Require on index.

Will only require the module after the first index of a module. Only works
for modules that export a table.

lazy.require_on_module_call() *lazy.require_on_module_call()*
Requires only when you call the _module_ itself.

If you want to require an exported value from the module, see instead
|lazy.require_on_exported_call()|

lazy.require_on_exported_call() *lazy.require_on_exported_call()*
Require when an exported method is called.

Creates a new function. Cannot be used to compare functions, set new
values, etc. Only useful for waiting to do the require until you actually
call the code.

-- This is not loaded yet
local lazy_mod = lazy.require_on_exported_call('my_module')
local lazy_func = lazy_mod.exported_func

-- ... some time later
lazy_func(42) -- <- Only loads the module now

vim:tw=78:ts=8:ft=help:norl:
```