From 91be187aeae1ad820d8548a662f83d6fbcec95d9 Mon Sep 17 00:00:00 2001 From: siduck Date: Sun, 1 Oct 2023 12:59:30 +0530 Subject: [PATCH] rm misleading docs for function* used in opts spec --- src/routes/(index)/docs/config/plugins.mdx | 41 +++++++++++----------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/routes/(index)/docs/config/plugins.mdx b/src/routes/(index)/docs/config/plugins.mdx index 732507f2..4eb8f371 100644 --- a/src/routes/(index)/docs/config/plugins.mdx +++ b/src/routes/(index)/docs/config/plugins.mdx @@ -26,6 +26,7 @@ M.plugins = "custom.plugins"
- **custom/plugins.lua** + ```lua local plugins = { @@ -47,28 +48,28 @@ local plugins = { ensure_installed = {"html", "css", "bash"}, }, }, - - -- if you load some function or module within your opt, wrap it with a function + { - "nvim-telescope/telescope.nvim", - opts = { - defaults = { - mappings = { - i = { - [""] = function(...) - require("telescope.actions").close(...) - end, - }, - }, - }, - }, - }, - - { - "folke/which-key.nvim", - enabled = false, - } + "folke/which-key.nvim", + enabled = false, + }, + -- If your opts uses a function call, then make opts spec a function* + -- should return the modified default config as well + -- here we just call the default telescope config + -- and then assign a function to some of its options + { + "nvim-telescope/telescope.nvim", + opts = function() + local conf = require "plugins.configs.telescope" + conf.defaults.mappings.i = { + [""] = require("telescope.actions").move_selection_next, + [""] = require("telescope.actions").close, + } + + return conf + end, + } } return plugins