diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2021-08-09 21:28:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-09 21:28:16 +0200 |
| commit | 2c573b9d12f421cec74a215f79b25591fe083352 (patch) | |
| tree | 77b6c56b511163649e6cb7fbadd1e0be81990c21 /lua | |
| parent | 273942cc478b356d7b2e0a5211281daaef69d161 (diff) | |
fix: picker config (#1094)
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/builtin/init.lua | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/lua/telescope/builtin/init.lua b/lua/telescope/builtin/init.lua index ac78058..70c4302 100644 --- a/lua/telescope/builtin/init.lua +++ b/lua/telescope/builtin/init.lua @@ -383,26 +383,28 @@ builtin.lsp_workspace_diagnostics = require("telescope.builtin.lsp").workspace_d local apply_config = function(mod) local pickers_conf = require("telescope.config").pickers for k, v in pairs(mod) do - local pconf = vim.deepcopy(pickers_conf[k] or {}) - if pconf.theme then - local theme = pconf.theme - pconf.theme = nil - pconf = require("telescope.themes")["get_" .. 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 - for key, action in pairs(tbl) do - map(mode, key, action) + mod[k] = function(opts) + opts = opts or {} + + local pconf = vim.deepcopy(pickers_conf[k] or {}) + if pconf.theme then + local theme = pconf.theme + pconf.theme = nil + pconf = require("telescope.themes")["get_" .. 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 + for key, action in pairs(tbl) do + map(mode, key, action) + end end + return true end - return true end - end - mod[k] = function(opts) - opts = opts or {} + if pconf.attach_mappings and opts.attach_mappings then local attach_mappings = pconf.attach_mappings pconf.attach_mappings = nil |
