Skip to content

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

License

Notifications You must be signed in to change notification settings

tjdevries/lazy-require.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# 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:
```

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages