mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-19 12:56:46 +00:00
docs: prefer opts over config
This commit is contained in:
parent
5a681c3e31
commit
78db53118c
2 changed files with 55 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
sidebar_position: 7
|
||||
---
|
||||
|
||||
# 🔥 Developers
|
||||
|
||||
To make it easier for users to install your plugin, you can include a [package spec](/packages) in your repo.
|
||||
|
@ -19,6 +20,29 @@ To make it easier for users to install your plugin, you can include a [package s
|
|||
{ "nvim-lua/plenary.nvim", lazy = true }
|
||||
```
|
||||
|
||||
- Always use `opts` instead of `config` when possible. `config` is almost never needed.
|
||||
|
||||
:::tip[GOOD]
|
||||
|
||||
```lua
|
||||
{ "folke/todo-comments.nvim", opts = {} },
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
:::danger[BAD]
|
||||
|
||||
```lua
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
config = function()
|
||||
require("todo-comments").setup({})
|
||||
end,
|
||||
},
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
- 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`.
|
||||
|
@ -163,4 +187,3 @@ Then run it with:
|
|||
```sh
|
||||
nvim -u repro.lua
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue