refactor: use opts everywhere, so any plugin config can now be extended

This commit is contained in:
Folke Lemaitre 2023-01-08 16:13:22 +01:00
parent 6c73e775cf
commit 77b5e9ab56
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
3 changed files with 40 additions and 32 deletions

View file

@ -83,8 +83,8 @@ return {
{
"echasnovski/mini.pairs",
event = "VeryLazy",
config = function()
require("mini.pairs").setup({})
config = function(_, opts)
require("mini.pairs").setup(opts)
end,
},
@ -92,19 +92,20 @@ return {
{
"echasnovski/mini.surround",
keys = { "gz" },
config = function()
opts = {
mappings = {
add = "gza", -- Add surrounding in Normal and Visual modes
delete = "gzd", -- Delete surrounding
find = "gzf", -- Find surrounding (to the right)
find_left = "gzF", -- Find surrounding (to the left)
highlight = "gzh", -- Highlight surrounding
replace = "gzr", -- Replace surrounding
update_n_lines = "gzn", -- Update `n_lines`
},
},
config = function(_, opts)
-- use gz mappings instead of s to prevent conflict with leap
require("mini.surround").setup({
mappings = {
add = "gza", -- Add surrounding in Normal and Visual modes
delete = "gzd", -- Delete surrounding
find = "gzf", -- Find surrounding (to the right)
find_left = "gzF", -- Find surrounding (to the left)
highlight = "gzh", -- Highlight surrounding
replace = "gzr", -- Replace surrounding
update_n_lines = "gzn", -- Update `n_lines`
},
})
require("mini.surround").setup(opts)
end,
},
@ -113,14 +114,15 @@ return {
{
"echasnovski/mini.comment",
event = "VeryLazy",
config = function()
require("mini.comment").setup({
hooks = {
pre = function()
require("ts_context_commentstring.internal").update_commentstring({})
end,
},
})
opts = {
hooks = {
pre = function()
require("ts_context_commentstring.internal").update_commentstring({})
end,
},
},
config = function(_, opts)
require("mini.comment").setup(opts)
end,
},