mirror of https://github.com/folke/lazy.nvim.git
chore(build): auto-generate docs
This commit is contained in:
parent
859da3df2f
commit
65b92c369a
101
README.vim.md
101
README.vim.md
|
@ -3,20 +3,32 @@
|
||||||
## 11.x
|
## 11.x
|
||||||
|
|
||||||
- **New Website**: There's a whole new website with a fresh look and improved documentation.
|
- **New Website**: There's a whole new website with a fresh look and improved documentation.
|
||||||
Check it out at [lazy.nvim](https://lazy.folke.io/).
|
Check it out at [https://lazy.folke.io](https://lazy.folke.io/).
|
||||||
The GitHub `README.md` has been updated to point to the new website.
|
The GitHub `README.md` has been updated to point to the new website.
|
||||||
The `vimdoc` contains all the information that is available on the website.
|
The `vimdoc` contains all the information that is available on the website.
|
||||||
|
|
||||||
- **Spec Resolution & Merging**: the code that resolves a final spec from a plugin's fragments has been rewritten.
|
- **Spec Resolution & Merging**: the code that resolves a final spec from a plugin's fragments has been rewritten.
|
||||||
This should be a tiny bit faster, but more importantly, fixes some issues and is easier to maintain.
|
This should be a tiny bit faster, but more importantly, fixes some issues and is easier to maintain.
|
||||||
|
|
||||||
- `rocks`: specs can now specify a list of rocks ([luarocks](https://luarocks.org/)) that should be installed.
|
|
||||||
|
|
||||||
- [Packages](https://lazy.folke.io/packages) can now specify their dependencies and configuration using one of:
|
- [Packages](https://lazy.folke.io/packages) can now specify their dependencies and configuration using one of:
|
||||||
|
|
||||||
- **Lazy**: `lazy.lua` file
|
- **Lazy**: `lazy.lua` file
|
||||||
- **Rockspec**: [luarocks](https://luarocks.org/) `*-scm-1.rockspec` [file](https://github.com/luarocks/luarocks/wiki/Rockspec-format)
|
- **Rockspec**: [luarocks](https://luarocks.org/) `*-scm-1.rockspec` [file](https://github.com/luarocks/luarocks/wiki/Rockspec-format)
|
||||||
- **Packspec**: `pkg.json` (experimental, since the [format](https://github.com/neovim/packspec/issues/41) is not quite there yet)
|
- **Packspec**: `pkg.json` (experimental, since the [format](https://github.com/neovim/packspec/issues/41) is not quite there yet)
|
||||||
|
|
||||||
|
- Packages are not limited to just Neovim plugins. You can install any **luarocks** package, like:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
{ "https://github.com/lubyk/yaml" }
|
||||||
|
```
|
||||||
|
|
||||||
|
Luarocks packages without a `/lua` directory are never lazy-loaded, since it's just a library.
|
||||||
|
|
||||||
|
- `build` functions or `*.lua` build files (like `build.lua`) now run asynchronously.
|
||||||
|
You can use `coroutine.yield(status_msg)` to show progress.
|
||||||
|
Yielding will also schedule the next `resume` to run in the next tick,
|
||||||
|
so you can do long-running tasks without blocking Neovim.
|
||||||
|
|
||||||
# 🚀 Getting Started
|
# 🚀 Getting Started
|
||||||
|
|
||||||
**lazy.nvim** is a modern plugin manager for Neovim.
|
**lazy.nvim** is a modern plugin manager for Neovim.
|
||||||
|
@ -183,13 +195,12 @@ A valid spec should define one of `[1]`, `dir` or `url`.
|
||||||
## Spec Setup
|
## Spec Setup
|
||||||
|
|
||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
| ---------- | --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ---------- | --------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| **init** | `fun(LazyPlugin)` | `init` functions are always executed during startup |
|
| **init** | `fun(LazyPlugin)` | `init` functions are always executed during startup |
|
||||||
| **opts** | `table` or `fun(LazyPlugin, opts:table)` | `opts` should be a table (will be merged with parent specs), return a table (replaces parent specs) or should change a table. The table will be passed to the `Plugin.config()` function. Setting this value will imply `Plugin.config()` |
|
| **opts** | `table` or `fun(LazyPlugin, opts:table)` | `opts` should be a table (will be merged with parent specs), return a table (replaces parent specs) or should change a table. The table will be passed to the `Plugin.config()` function. Setting this value will imply `Plugin.config()` |
|
||||||
| **config** | `fun(LazyPlugin, opts:table)` or `true` | `config` is executed when the plugin loads. The default implementation will automatically run `require(MAIN).setup(opts)` if `opts` or `config = true` is set. Lazy uses several heuristics to determine the plugin's `MAIN` module automatically based on the plugin's **name**. See also `opts`. To use the default implementation without `opts` set `config` to `true`. |
|
| **config** | `fun(LazyPlugin, opts:table)` or `true` | `config` is executed when the plugin loads. The default implementation will automatically run `require(MAIN).setup(opts)` if `opts` or `config = true` is set. Lazy uses several heuristics to determine the plugin's `MAIN` module automatically based on the plugin's **name**. See also `opts`. To use the default implementation without `opts` set `config` to `true`. |
|
||||||
| **main** | `string?` | You can specify the `main` module to use for `config()` and `opts()`, in case it can not be determined automatically. See `config()` |
|
| **main** | `string?` | You can specify the `main` module to use for `config()` and `opts()`, in case it can not be determined automatically. See `config()` |
|
||||||
| **build** | `fun(LazyPlugin)` or `string` or a list of build commands | `build` is executed when a plugin is installed or updated. Before running `build`, a plugin is first loaded. If it's a string it will be run as a shell command. When prefixed with `:` it is a Neovim command. You can also specify a list to executed multiple build commands. Some plugins provide their own `build.lua` which is automatically used by lazy. So no need to specify a build step for those plugins. |
|
| **build** | `fun(LazyPlugin)` or `string` or a list of build commands | `build` is executed when a plugin is installed or updated. See [Building](/developers#building) for more information. |
|
||||||
| **rocks** | `string[]?` | Add any [luarocks](https://luarocks.org/) dependencies. |
|
|
||||||
|
|
||||||
## Spec Lazy Loading
|
## Spec Lazy Loading
|
||||||
|
|
||||||
|
@ -431,7 +442,7 @@ Syntax is the same as any plugin spec.
|
||||||
|
|
||||||
## Rockspec
|
## Rockspec
|
||||||
|
|
||||||
When a plugin contains a `*-scm-1.rockspec` file, **lazy.nvim** will automatically load its [`rocks`](/spec#setup) dependencies.
|
When a plugin contains a `*-1.rockspec` file, **lazy.nvim** will automatically build the rock and its dependencies.
|
||||||
|
|
||||||
## Packspec
|
## Packspec
|
||||||
|
|
||||||
|
@ -976,12 +987,78 @@ specs, adding any keys you want to override / merge.
|
||||||
`opts`, `dependencies`, `cmd`, `event`, `ft` and `keys` are always merged with the parent spec.
|
`opts`, `dependencies`, `cmd`, `event`, `ft` and `keys` are always merged with the parent spec.
|
||||||
Any other property will override the property from the parent spec.
|
Any other property will override the property from the parent spec.
|
||||||
|
|
||||||
# 📚 Plugin Developers
|
# 🔥 Developers
|
||||||
|
|
||||||
To make it easier for users to install your plugin, you can include a [package spec](/packages) in your repo.
|
To make it easier for users to install your plugin, you can include a [package spec](/packages) in your repo.
|
||||||
|
|
||||||
If your plugin needs a build step, you can specify this in your **package file**,
|
## Best Practices
|
||||||
or create a file `build.lua` or `build/init.lua` in the root of your repo.
|
|
||||||
This file will be loaded when the plugin is installed or updated.
|
|
||||||
|
|
||||||
This makes it easier for users, as they no longer need to specify a `build` command.
|
- If your plugin needs `setup()`, then create a simple `lazy.lua` file like this:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
return { "me/my-plugin", opts = {} }
|
||||||
|
```
|
||||||
|
|
||||||
|
- Plugins that are pure lua libraries should be lazy-loaded with `lazy = true`.
|
||||||
|
|
||||||
|
```lua
|
||||||
|
{ "nvim-lua/plenary.nvim", lazy = true }
|
||||||
|
```
|
||||||
|
|
||||||
|
- Only use `dependencies` if a plugin needs the dep to be installed **AND** loaded.
|
||||||
|
Lua plugins/libraries are automatically loaded when they are `require()`d,
|
||||||
|
so they don't need to be in `dependencies`.
|
||||||
|
|
||||||
|
:::tip[GOOD]
|
||||||
|
|
||||||
|
```lua
|
||||||
|
{ "folke/todo-comments.nvim", opts = {} },
|
||||||
|
{ "nvim-lua/plenary.nvim", lazy = true },
|
||||||
|
```
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
:::danger[BAD]
|
||||||
|
|
||||||
|
```lua
|
||||||
|
{
|
||||||
|
"folke/todo-comments.nvim",
|
||||||
|
opts = {},
|
||||||
|
-- This will always load plenary as soon as todo-comments loads,
|
||||||
|
-- even when todo-comments doesn't use it.
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim", lazy = true },
|
||||||
|
},
|
||||||
|
```
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
- Inside a `build` function or `*.lua` build file, use `coroutine.yield(status_msg)` to show progress.
|
||||||
|
|
||||||
|
- Don't change the `cwd` in your build function, since builds run in parallel and changing the `cwd` will affect other builds.
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
The spec **build** property can be one of the following:
|
||||||
|
|
||||||
|
- `fun(plugin: LazyPlugin)`: a function that builds the plugin.
|
||||||
|
- `*.lua`: a Lua file that builds the plugin (like `build.lua`)
|
||||||
|
- `":Command"`: a Neovim command
|
||||||
|
- `"rockspec"`: this will run `luarocks make` in the plugin's directory
|
||||||
|
This is automatically set by the `rockspec` [package](/packages) source.
|
||||||
|
- any other **string** will be run as a shell command
|
||||||
|
- a `list` of any of the above to run multiple build steps
|
||||||
|
- if no `build` is specified, but a `build.lua` file exists, that will be used instead.
|
||||||
|
|
||||||
|
Build functions and `*.lua` files run asynchronously in a coroutine.
|
||||||
|
Use `coroutine.yield(status_msg)` to show progress.
|
||||||
|
Yielding will also schedule the next `coroutine.resume()` to run in the next tick, so you can do long-running tasks without blocking Neovim.
|
||||||
|
|
||||||
|
:::tip
|
||||||
|
|
||||||
|
If you need to know the directory of your build lua file, you can use:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local dir = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":p:h")
|
||||||
|
```
|
||||||
|
|
||||||
|
:::
|
|
@ -36,7 +36,9 @@ Table of Contents *lazy.nvim-table-of-contents*
|
||||||
- 📦 Migration Guide |lazy.nvim-🚀-usage-📦-migration-guide|
|
- 📦 Migration Guide |lazy.nvim-🚀-usage-📦-migration-guide|
|
||||||
- ⚡ Profiling & Debug |lazy.nvim-🚀-usage-⚡-profiling-&-debug|
|
- ⚡ Profiling & Debug |lazy.nvim-🚀-usage-⚡-profiling-&-debug|
|
||||||
- 📂 Structuring Your Plugins|lazy.nvim-🚀-usage-📂-structuring-your-plugins|
|
- 📂 Structuring Your Plugins|lazy.nvim-🚀-usage-📂-structuring-your-plugins|
|
||||||
8. 📚 Plugin Developers |lazy.nvim-📚-plugin-developers|
|
8. 🔥 Developers |lazy.nvim-🔥-developers|
|
||||||
|
- Best Practices |lazy.nvim-🔥-developers-best-practices|
|
||||||
|
- Building |lazy.nvim-🔥-developers-building|
|
||||||
9. Links |lazy.nvim-links|
|
9. Links |lazy.nvim-links|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
@ -46,19 +48,28 @@ Table of Contents *lazy.nvim-table-of-contents*
|
||||||
11.X *lazy.nvim-📰-what’s-new?-11.x*
|
11.X *lazy.nvim-📰-what’s-new?-11.x*
|
||||||
|
|
||||||
- **New Website**: There’s a whole new website with a fresh look and improved
|
- **New Website**: There’s a whole new website with a fresh look and improved
|
||||||
documentation. Check it out at lazy.nvim <https://lazy.folke.io/>. The GitHub
|
documentation. Check it out at <https://lazy.folke.io>. The GitHub `README.md`
|
||||||
`README.md` has been updated to point to the new website. The `vimdoc` contains
|
has been updated to point to the new website. The `vimdoc` contains all the
|
||||||
all the information that is available on the website.
|
information that is available on the website.
|
||||||
- **Spec Resolution & Merging**: the code that resolves a final spec from a
|
- **Spec Resolution & Merging**: the code that resolves a final spec from a
|
||||||
plugin’s fragments has been rewritten. This should be a tiny bit faster, but
|
plugin’s fragments has been rewritten. This should be a tiny bit faster, but
|
||||||
more importantly, fixes some issues and is easier to maintain.
|
more importantly, fixes some issues and is easier to maintain.
|
||||||
- `rocks`: specs can now specify a list of rocks (luarocks
|
|
||||||
<https://luarocks.org/>) that should be installed.
|
|
||||||
- Packages <https://lazy.folke.io/packages> can now specify their dependencies
|
- Packages <https://lazy.folke.io/packages> can now specify their dependencies
|
||||||
and configuration using one of:
|
and configuration using one of:
|
||||||
- **Lazy**: `lazy.lua` file
|
- **Lazy**: `lazy.lua` file
|
||||||
- **Rockspec**: luarocks <https://luarocks.org/> `*-scm-1.rockspec` file <https://github.com/luarocks/luarocks/wiki/Rockspec-format>
|
- **Rockspec**: luarocks <https://luarocks.org/> `*-scm-1.rockspec` file <https://github.com/luarocks/luarocks/wiki/Rockspec-format>
|
||||||
- **Packspec**: `pkg.json` (experimental, since the format <https://github.com/neovim/packspec/issues/41> is not quite there yet)
|
- **Packspec**: `pkg.json` (experimental, since the format <https://github.com/neovim/packspec/issues/41> is not quite there yet)
|
||||||
|
- Packages are not limited to just Neovim plugins. You can install any
|
||||||
|
**luarocks** package, like:
|
||||||
|
>lua
|
||||||
|
{ "https://github.com/lubyk/yaml" }
|
||||||
|
<
|
||||||
|
Luarocks packages without a `/lua` directory are never lazy-loaded, since
|
||||||
|
it’s just a library.
|
||||||
|
- `build` functions or `*.lua` build files (like `build.lua`) now run
|
||||||
|
asynchronously. You can use `coroutine.yield(status_msg)` to show progress.
|
||||||
|
Yielding will also schedule the next `resume` to run in the next tick, so you
|
||||||
|
can do long-running tasks without blocking Neovim.
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
@ -235,9 +246,9 @@ SPEC LOADING *lazy.nvim-🔌-plugin-spec-spec-loading*
|
||||||
|
|
||||||
SPEC SETUP *lazy.nvim-🔌-plugin-spec-spec-setup*
|
SPEC SETUP *lazy.nvim-🔌-plugin-spec-spec-setup*
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
||||||
Property Type Description
|
Property Type Description
|
||||||
---------- ----------------------------- ------------------------------------------------------------
|
---------- ----------------------------- -----------------------------------------------------------
|
||||||
init fun(LazyPlugin) init functions are always executed during startup
|
init fun(LazyPlugin) init functions are always executed during startup
|
||||||
|
|
||||||
opts table or opts should be a table (will be merged with parent specs),
|
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*
|
||||||
config()
|
config()
|
||||||
|
|
||||||
build fun(LazyPlugin) or string or build is executed when a plugin is installed or updated.
|
build fun(LazyPlugin) or string or build is executed when a plugin is installed or updated.
|
||||||
a list of build commands Before running build, a plugin is first loaded. If it’s a
|
a list of build commands See Building for more information.
|
||||||
string it will be run as a shell command. When prefixed with
|
----------------------------------------------------------------------------------------------------
|
||||||
: it is a Neovim command. You can also specify a list to
|
|
||||||
executed multiple build commands. Some plugins provide their
|
|
||||||
own build.lua which is automatically used by lazy. So no
|
|
||||||
need to specify a build step for those plugins.
|
|
||||||
|
|
||||||
rocks string[]? Add any luarocks dependencies.
|
|
||||||
-----------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
SPEC LAZY LOADING *lazy.nvim-🔌-plugin-spec-spec-lazy-loading*
|
SPEC LAZY LOADING *lazy.nvim-🔌-plugin-spec-spec-lazy-loading*
|
||||||
|
|
||||||
|
@ -535,8 +539,8 @@ dependencies and configuration. Syntax is the same as any plugin spec.
|
||||||
|
|
||||||
ROCKSPEC *lazy.nvim-📦-packages-rockspec*
|
ROCKSPEC *lazy.nvim-📦-packages-rockspec*
|
||||||
|
|
||||||
When a plugin contains a `*-scm-1.rockspec` file, **lazy.nvim** will
|
When a plugin contains a `*-1.rockspec` file, **lazy.nvim** will automatically
|
||||||
automatically load its `rocks` </spec#setup> dependencies.
|
build the rock and its dependencies.
|
||||||
|
|
||||||
|
|
||||||
PACKSPEC *lazy.nvim-📦-packages-packspec*
|
PACKSPEC *lazy.nvim-📦-packages-packspec*
|
||||||
|
@ -1175,17 +1179,49 @@ spec.
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
8. 📚 Plugin Developers *lazy.nvim-📚-plugin-developers*
|
8. 🔥 Developers *lazy.nvim-🔥-developers*
|
||||||
|
|
||||||
To make it easier for users to install your plugin, you can include a package
|
To make it easier for users to install your plugin, you can include a package
|
||||||
spec </packages> in your repo.
|
spec </packages> in your repo.
|
||||||
|
|
||||||
If your plugin needs a build step, you can specify this in your **package
|
|
||||||
file**, or create a file `build.lua` or `build/init.lua` in the root of your
|
|
||||||
repo. This file will be loaded when the plugin is installed or updated.
|
|
||||||
|
|
||||||
This makes it easier for users, as they no longer need to specify a `build`
|
BEST PRACTICES *lazy.nvim-🔥-developers-best-practices*
|
||||||
command.
|
|
||||||
|
- If your plugin needs `setup()`, then create a simple `lazy.lua` file like this:
|
||||||
|
>lua
|
||||||
|
return { "me/my-plugin", opts = {} }
|
||||||
|
<
|
||||||
|
- Plugins that are pure lua libraries should be lazy-loaded with `lazy = true`.
|
||||||
|
>lua
|
||||||
|
{ "nvim-lua/plenary.nvim", lazy = true }
|
||||||
|
<
|
||||||
|
- Only use `dependencies` if a plugin needs the dep to be installed **AND**
|
||||||
|
loaded. Lua plugins/libraries are automatically loaded when they are
|
||||||
|
`require()`d, so they don’t need to be in `dependencies`.
|
||||||
|
- Inside a `build` function or `*.lua` build file, use
|
||||||
|
`coroutine.yield(status_msg)` to show progress.
|
||||||
|
- Don’t change the `cwd` in your build function, since builds run in parallel
|
||||||
|
and changing the `cwd` will affect other builds.
|
||||||
|
|
||||||
|
|
||||||
|
BUILDING *lazy.nvim-🔥-developers-building*
|
||||||
|
|
||||||
|
The spec **build** property can be one of the following:
|
||||||
|
|
||||||
|
- `fun(plugin: LazyPlugin)`: a function that builds the plugin.
|
||||||
|
- `*.lua`: a Lua file that builds the plugin (like `build.lua`)
|
||||||
|
- `":Command"`: a Neovim command
|
||||||
|
- `"rockspec"`: this will run `luarocks make` in the plugin’s directory
|
||||||
|
This is automatically set by the `rockspec` package </packages> source.
|
||||||
|
- any other **string** will be run as a shell command
|
||||||
|
- a `list` of any of the above to run multiple build steps
|
||||||
|
- if no `build` is specified, but a `build.lua` file exists, that will be used instead.
|
||||||
|
|
||||||
|
Build functions and `*.lua` files run asynchronously in a coroutine. Use
|
||||||
|
`coroutine.yield(status_msg)` to show progress. Yielding will also schedule the
|
||||||
|
next `coroutine.resume()` to run in the next tick, so you can do long-running
|
||||||
|
tasks without blocking Neovim.
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
9. Links *lazy.nvim-links*
|
9. Links *lazy.nvim-links*
|
||||||
|
|
|
@ -187,12 +187,6 @@ sidebar_position: 5
|
||||||
skip_if_doc_exists = true,
|
skip_if_doc_exists = true,
|
||||||
},
|
},
|
||||||
state = vim.fn.stdpath("state") .. "/lazy/state.json", -- state info for checker and other things
|
state = vim.fn.stdpath("state") .. "/lazy/state.json", -- state info for checker and other things
|
||||||
build = {
|
|
||||||
-- Plugins can provide a `build.lua` file that will be executed when the plugin is installed
|
|
||||||
-- or updated. When the plugin spec also has a `build` command, the plugin's `build.lua` not be
|
|
||||||
-- executed. In this case, a warning message will be shown.
|
|
||||||
warn_on_override = true,
|
|
||||||
},
|
|
||||||
-- Enable profiling of lazy.nvim. This will add some overhead,
|
-- Enable profiling of lazy.nvim. This will add some overhead,
|
||||||
-- so only enable this when you are debugging lazy.nvim
|
-- so only enable this when you are debugging lazy.nvim
|
||||||
profiling = {
|
profiling = {
|
||||||
|
|
Loading…
Reference in New Issue