From 1381e924cf72c6fbc513d9ffc7a09766ff50b6f2 Mon Sep 17 00:00:00 2001 From: siduck Date: Sun, 29 May 2022 20:26:16 +0530 Subject: [PATCH] fix no lspmappings without custom mappings | https://github.com/NvChad/NvChad/commit/0f013d4e7b52da7978b386c281cd026413543417#commitcomment-74845391 --- lua/core/utils.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lua/core/utils.lua b/lua/core/utils.lua index ba94f86..4303015 100644 --- a/lua/core/utils.lua +++ b/lua/core/utils.lua @@ -92,22 +92,22 @@ M.load_mappings = function(mappings, mapping_opt) end end - mappings.lspconfig = nil + for section, section_mappings in pairs(mappings) do + if section ~= "lspconfig" then + -- skip mapping this as its mapppings are loaded in lspconfiguti + for mode, mode_mappings in pairs(section_mappings) do + for keybind, mapping_info in pairs(mode_mappings) do + -- merge default + user opts - for _, section_mappings in pairs(mappings) do - -- skip mapping this as its mapppings are loaded in lspconfiguti - for mode, mode_mappings in pairs(section_mappings) do - for keybind, mapping_info in pairs(mode_mappings) do - -- merge default + user opts + local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {}) + local opts = merge_tb("force", default_opts, mapping_info.opts or {}) - local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {}) - local opts = merge_tb("force", default_opts, mapping_info.opts or {}) + if mapping_info.opts then + mapping_info.opts = nil + end - if mapping_info.opts then - mapping_info.opts = nil + map_func(keybind, mapping_info, opts) end - - map_func(keybind, mapping_info, opts) end end end