Skip to content

Commit 6040b2c

Browse files
bleachedapetalas
authored andcommitted
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 5d2bbf8 commit 6040b2c

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
@@ -253,15 +253,25 @@ require('lazy').setup({
253253
-- with the first argument being the link and the following
254254
-- keys can be used to configure plugin behavior/loading/etc.
255255
--
256-
-- Use `opts = {}` to force a plugin to be loaded.
256+
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
257257
--
258258

259259
-- floating terminal
260260
{ 'numToStr/Fterm.nvim', opts = {} },
261261

262+
-- Alternatively, use `config = function() ... end` for full control over the configuration.
263+
-- If you prefer to call `setup` explicitly, use:
264+
-- {
265+
-- 'lewis6991/gitsigns.nvim',
266+
-- config = function()
267+
-- require('gitsigns').setup({
268+
-- -- Your gitsigns configuration here
269+
-- })
270+
-- end,
271+
-- }
272+
--
262273
-- Here is a more advanced example where we pass configuration
263-
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
264-
-- require('gitsigns').setup({ ... })
274+
-- options to `gitsigns.nvim`.
265275
--
266276
-- See `:help gitsigns` to understand what the configuration keys do
267277
{ -- Adds git related signs to the gutter, as well as utilities for managing changes

0 commit comments

Comments
 (0)