From 8f196b307778928f49928a17892a1c6353204a2b Mon Sep 17 00:00:00 2001 From: bleacheda <60625523+bleacheda@users.noreply.github.com> Date: Sun, 19 Jan 2025 21:24:34 +0200 Subject: [PATCH 1/3] 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. --- init.lua | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index 4eae8e7d95a..e7e904b0d25 100644 --- a/init.lua +++ b/init.lua @@ -234,13 +234,22 @@ require('lazy').setup({ -- with the first argument being the link and the following -- keys can be used to configure plugin behavior/loading/etc. -- - -- Use `opts = {}` to force a plugin to be loaded. + -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded. -- - - -- Here is a more advanced example where we pass configuration - -- options to `gitsigns.nvim`. This is equivalent to the following Lua: - -- require('gitsigns').setup({ ... }) + -- Alternatively, use `config = function() ... end` for full control over the configuration. + -- If you prefer to call `setup` explicitly, use: + -- { + -- 'lewis6991/gitsigns.nvim', + -- config = function() + -- require('gitsigns').setup({ + -- -- Your gitsigns configuration here + -- }) + -- end, + -- } -- + -- Here is a more advanced example where we pass configuration + -- options to `gitsigns.nvim`. + -- -- See `:help gitsigns` to understand what the configuration keys do { -- Adds git related signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', From 2252b140ddba114a5fcf0e390d67435a4bff517a Mon Sep 17 00:00:00 2001 From: bleacheda <60625523+bleacheda@users.noreply.github.com> Date: Sun, 19 Jan 2025 21:36:51 +0200 Subject: [PATCH 2/3] Update init.lua --- init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/init.lua b/init.lua index e7e904b0d25..aebecc8081a 100644 --- a/init.lua +++ b/init.lua @@ -236,6 +236,7 @@ require('lazy').setup({ -- -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded. -- + -- Alternatively, use `config = function() ... end` for full control over the configuration. -- If you prefer to call `setup` explicitly, use: -- { From 8834de4589686e3bb24aafd7698fd3204f86ea53 Mon Sep 17 00:00:00 2001 From: Andrei Staicu Date: Sun, 19 Jan 2025 22:34:28 +0200 Subject: [PATCH 3/3] remove whitespace --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index aebecc8081a..99c7c9cb0a9 100644 --- a/init.lua +++ b/init.lua @@ -250,7 +250,7 @@ require('lazy').setup({ -- -- Here is a more advanced example where we pass configuration -- options to `gitsigns.nvim`. - -- + -- -- See `:help gitsigns` to understand what the configuration keys do { -- Adds git related signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim',