summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorSimon Hauser <Simon-Hauser@outlook.de>2021-08-21 20:02:38 +0200
committerGitHub <noreply@github.com>2021-08-21 21:02:38 +0300
commit1c276f5539786fa96a6da8ed0c199dfb980e9a21 (patch)
treeafe3be1176184d0f37ae1f76ce68a686eeca00f6 /lua
parent364d795d22e7a080be793379e30cfdd2036840cf (diff)
fix(pickers): config mappings (#1147)
This happens because we removed our packed deepcopy. So i refactored this part to not do a deepcopy
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/builtin/init.lua19
1 files changed, 7 insertions, 12 deletions
diff --git a/lua/telescope/builtin/init.lua b/lua/telescope/builtin/init.lua
index 9dc29af..c325f55 100644
--- a/lua/telescope/builtin/init.lua
+++ b/lua/telescope/builtin/init.lua
@@ -391,18 +391,15 @@ local apply_config = function(mod)
for k, v in pairs(mod) do
mod[k] = function(opts)
opts = opts or {}
+ local defaults = {}
- local pconf = vim.deepcopy(pickers_conf[k] or {})
+ local pconf = pickers_conf[k] or {}
if pconf.theme then
- local theme = pconf.theme
- pconf.theme = nil
- pconf = require("telescope.themes")["get_" .. theme](pconf)
+ defaults = require("telescope.themes")["get_" .. pconf.theme](pconf)
end
if pconf.mappings then
- local mappings = pconf.mappings
- pconf.mappings = nil
- pconf.attach_mappings = function(_, map)
- for mode, tbl in pairs(mappings) do
+ defaults.attach_mappings = function(_, map)
+ for mode, tbl in pairs(pconf.mappings) do
for key, action in pairs(tbl) do
map(mode, key, action)
end
@@ -412,16 +409,14 @@ local apply_config = function(mod)
end
if pconf.attach_mappings and opts.attach_mappings then
- local attach_mappings = pconf.attach_mappings
- pconf.attach_mappings = nil
local opts_attach = opts.attach_mappings
opts.attach_mappings = function(prompt_bufnr, map)
- attach_mappings(prompt_bufnr, map)
+ pconf.attach_mappings(prompt_bufnr, map)
return opts_attach(prompt_bufnr, map)
end
end
- v(vim.tbl_extend("force", pconf, opts))
+ v(vim.tbl_extend("force", defaults, opts))
end
end