Skip to content

Commit 0a7fce5

Browse files
bleachedaShrinivas Kamath
authored and
Shrinivas Kamath
committed
docs: clarify using opts = {} vs config = function() ... require('plu… (nvim-lua#1316)
* docs: clarify using opts = {} vs config = function() ... require('plugin').setup({}) .. end The current documentation mentioning that using "require" is equivalent to using "opts" without detailing the use in the "config = function()" block seems inaccurate. Lower in the configuration the "config = function()" block is used without clarifying why it needed and what it does. This clarification may help new users understand the difference between the two, or how and where to place the "require" statement. * Update init.lua * remove whitespace
1 parent 7d9f124 commit 0a7fce5

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

init.lua

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,22 @@ require('lazy').setup({
244244
-- with the first argument being the link and the following
245245
-- keys can be used to configure plugin behavior/loading/etc.
246246
--
247-
-- Use `opts = {}` to force a plugin to be loaded.
247+
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
248248
--
249249

250+
-- Alternatively, use `config = function() ... end` for full control over the configuration.
251+
-- If you prefer to call `setup` explicitly, use:
252+
-- {
253+
-- 'lewis6991/gitsigns.nvim',
254+
-- config = function()
255+
-- require('gitsigns').setup({
256+
-- -- Your gitsigns configuration here
257+
-- })
258+
-- end,
259+
-- }
260+
--
250261
-- Here is a more advanced example where we pass configuration
251-
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
252-
-- require('gitsigns').setup({ ... })
262+
-- options to `gitsigns.nvim`.
253263
--
254264
-- See `:help gitsigns` to understand what the configuration keys do
255265
{ -- Adds git related signs to the gutter, as well as utilities for managing changes

0 commit comments

Comments
 (0)