Skip to content

Commit fd04bc6

Browse files
github-actions[bot]folke
authored andcommitted
chore(build): auto-generate docs
1 parent b73c57e commit fd04bc6

File tree

1 file changed

+61
-25
lines changed

1 file changed

+61
-25
lines changed

doc/lazy.nvim.txt

+61-25
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ Table of Contents *lazy.nvim-table-of-contents*
3636
- 📦 Migration Guide |lazy.nvim-🚀-usage-📦-migration-guide|
3737
- ⚡ Profiling & Debug |lazy.nvim-🚀-usage-⚡-profiling-&-debug|
3838
- 📂 Structuring Your Plugins|lazy.nvim-🚀-usage-📂-structuring-your-plugins|
39-
8. 📚 Plugin Developers |lazy.nvim-📚-plugin-developers|
39+
8. 🔥 Developers |lazy.nvim-🔥-developers|
40+
- Best Practices |lazy.nvim-🔥-developers-best-practices|
41+
- Building |lazy.nvim-🔥-developers-building|
4042
9. Links |lazy.nvim-links|
4143

4244
==============================================================================
@@ -46,19 +48,28 @@ Table of Contents *lazy.nvim-table-of-contents*
4648
11.X *lazy.nvim-📰-what’s-new?-11.x*
4749

4850
- **New Website**: There’s a whole new website with a fresh look and improved
49-
documentation. Check it out at lazy.nvim <https://lazy.folke.io/>. The GitHub
50-
`README.md` has been updated to point to the new website. The `vimdoc` contains
51-
all the information that is available on the website.
51+
documentation. Check it out at <https://lazy.folke.io>. The GitHub `README.md`
52+
has been updated to point to the new website. The `vimdoc` contains all the
53+
information that is available on the website.
5254
- **Spec Resolution & Merging**: the code that resolves a final spec from a
5355
plugin’s fragments has been rewritten. This should be a tiny bit faster, but
5456
more importantly, fixes some issues and is easier to maintain.
55-
- `rocks`: specs can now specify a list of rocks (luarocks
56-
<https://luarocks.org/>) that should be installed.
5757
- Packages <https://lazy.folke.io/packages> can now specify their dependencies
5858
and configuration using one of:
5959
- **Lazy**: `lazy.lua` file
6060
- **Rockspec**: luarocks <https://luarocks.org/> `*-scm-1.rockspec` file <https://github.com/luarocks/luarocks/wiki/Rockspec-format>
6161
- **Packspec**: `pkg.json` (experimental, since the format <https://github.com/neovim/packspec/issues/41> is not quite there yet)
62+
- Packages are not limited to just Neovim plugins. You can install any
63+
**luarocks** package, like:
64+
>lua
65+
{ "https://github.com/lubyk/yaml" }
66+
<
67+
Luarocks packages without a `/lua` directory are never lazy-loaded, since
68+
it’s just a library.
69+
- `build` functions or `*.lua` build files (like `build.lua`) now run
70+
asynchronously. You can use `coroutine.yield(status_msg)` to show progress.
71+
Yielding will also schedule the next `resume` to run in the next tick, so you
72+
can do long-running tasks without blocking Neovim.
6273

6374

6475
==============================================================================
@@ -235,9 +246,9 @@ SPEC LOADING *lazy.nvim-🔌-plugin-spec-spec-loading*
235246

236247
SPEC SETUP *lazy.nvim-🔌-plugin-spec-spec-setup*
237248

238-
-----------------------------------------------------------------------------------------------------
249+
----------------------------------------------------------------------------------------------------
239250
Property Type Description
240-
---------- ----------------------------- ------------------------------------------------------------
251+
---------- ----------------------------- -----------------------------------------------------------
241252
init fun(LazyPlugin) init functions are always executed during startup
242253

243254
opts table or opts should be a table (will be merged with parent specs),
@@ -258,15 +269,8 @@ SPEC SETUP *lazy.nvim-🔌-plugin-spec-spec-setup*
258269
config()
259270

260271
build fun(LazyPlugin) or string or build is executed when a plugin is installed or updated.
261-
a list of build commands Before running build, a plugin is first loaded. If it’s a
262-
string it will be run as a shell command. When prefixed with
263-
: it is a Neovim command. You can also specify a list to
264-
executed multiple build commands. Some plugins provide their
265-
own build.lua which is automatically used by lazy. So no
266-
need to specify a build step for those plugins.
267-
268-
rocks string[]? Add any luarocks dependencies.
269-
-----------------------------------------------------------------------------------------------------
272+
a list of build commands See Building for more information.
273+
----------------------------------------------------------------------------------------------------
270274

271275
SPEC LAZY LOADING *lazy.nvim-🔌-plugin-spec-spec-lazy-loading*
272276

@@ -535,8 +539,8 @@ dependencies and configuration. Syntax is the same as any plugin spec.
535539

536540
ROCKSPEC *lazy.nvim-📦-packages-rockspec*
537541

538-
When a plugin contains a `*-scm-1.rockspec` file, **lazy.nvim** will
539-
automatically load its `rocks` </spec#setup> dependencies.
542+
When a plugin contains a `*-1.rockspec` file, **lazy.nvim** will automatically
543+
build the rock and its dependencies.
540544

541545

542546
PACKSPEC *lazy.nvim-📦-packages-packspec*
@@ -1175,17 +1179,49 @@ spec.
11751179

11761180

11771181
==============================================================================
1178-
8. 📚 Plugin Developers *lazy.nvim-📚-plugin-developers*
1182+
8. 🔥 Developers *lazy.nvim-🔥-developers*
11791183

11801184
To make it easier for users to install your plugin, you can include a package
11811185
spec </packages> in your repo.
11821186

1183-
If your plugin needs a build step, you can specify this in your **package
1184-
file**, or create a file `build.lua` or `build/init.lua` in the root of your
1185-
repo. This file will be loaded when the plugin is installed or updated.
11861187

1187-
This makes it easier for users, as they no longer need to specify a `build`
1188-
command.
1188+
BEST PRACTICES *lazy.nvim-🔥-developers-best-practices*
1189+
1190+
- If your plugin needs `setup()`, then create a simple `lazy.lua` file like this:
1191+
>lua
1192+
return { "me/my-plugin", opts = {} }
1193+
<
1194+
- Plugins that are pure lua libraries should be lazy-loaded with `lazy = true`.
1195+
>lua
1196+
{ "nvim-lua/plenary.nvim", lazy = true }
1197+
<
1198+
- Only use `dependencies` if a plugin needs the dep to be installed **AND**
1199+
loaded. Lua plugins/libraries are automatically loaded when they are
1200+
`require()`d, so they don’t need to be in `dependencies`.
1201+
- Inside a `build` function or `*.lua` build file, use
1202+
`coroutine.yield(status_msg)` to show progress.
1203+
- Don’t change the `cwd` in your build function, since builds run in parallel
1204+
and changing the `cwd` will affect other builds.
1205+
1206+
1207+
BUILDING *lazy.nvim-🔥-developers-building*
1208+
1209+
The spec **build** property can be one of the following:
1210+
1211+
- `fun(plugin: LazyPlugin)`: a function that builds the plugin.
1212+
- `*.lua`: a Lua file that builds the plugin (like `build.lua`)
1213+
- `":Command"`: a Neovim command
1214+
- `"rockspec"`: this will run `luarocks make` in the plugin’s directory
1215+
This is automatically set by the `rockspec` package </packages> source.
1216+
- any other **string** will be run as a shell command
1217+
- a `list` of any of the above to run multiple build steps
1218+
- if no `build` is specified, but a `build.lua` file exists, that will be used instead.
1219+
1220+
Build functions and `*.lua` files run asynchronously in a coroutine. Use
1221+
`coroutine.yield(status_msg)` to show progress. Yielding will also schedule the
1222+
next `coroutine.resume()` to run in the next tick, so you can do long-running
1223+
tasks without blocking Neovim.
1224+
11891225

11901226
==============================================================================
11911227
9. Links *lazy.nvim-links*

0 commit comments

Comments
 (0)