Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/tjdevries/lazy-require.nvim
- Owner: tjdevries
- License: mit
- Created: 2021-08-02T15:45:39.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-28T03:49:34.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T22:52:00.015Z (about 1 month ago)
- Language: Lua
- Size: 5.86 KB
- Stars: 111
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.nvimSupport:
- https://github.com/sponsors/tjdevrieslazy.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 nowvim:tw=78:ts=8:ft=help:norl:
```