From 5339bc42aef13fad87af7e29c1bb29f522b2c056 Mon Sep 17 00:00:00 2001 From: siduck Date: Tue, 12 Jul 2022 21:54:25 +0530 Subject: [PATCH] clean stuff remove vim tsparser as it is adviced to have 100% lua config and vim.cmd adds a lil overhead as compared to native vim api functions, increase shiftwidth as it looks better --- lua/core/options.lua | 2 +- lua/core/utils.lua | 22 ++++++++-------------- lua/plugins/configs/treesitter.lua | 1 - 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/lua/core/options.lua b/lua/core/options.lua index 9df3027..32cf12d 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -21,7 +21,7 @@ opt.cul = true -- cursor line -- Indenting opt.expandtab = true -opt.shiftwidth = 2 +opt.shiftwidth = 3 opt.smartindent = true opt.fillchars = { eob = " " } diff --git a/lua/core/utils.lua b/lua/core/utils.lua index 6a57d26..ba3f8bf 100644 --- a/lua/core/utils.lua +++ b/lua/core/utils.lua @@ -66,15 +66,15 @@ end M.load_mappings = function(mappings, mapping_opt) -- set mapping function with/without whichkey - local map_func + local set_maps local whichkey_exists, wk = pcall(require, "which-key") if whichkey_exists then - map_func = function(keybind, mapping_info, opts) + set_maps = function(keybind, mapping_info, opts) wk.register({ [keybind] = mapping_info }, opts) end else - map_func = function(keybind, mapping_info, opts) + set_maps = function(keybind, mapping_info, opts) local mode = opts.mode opts.mode = nil vim.keymap.set(mode, keybind, mapping_info[1], opts) @@ -84,20 +84,15 @@ M.load_mappings = function(mappings, mapping_opt) mappings = mappings or vim.deepcopy(M.load_config().mappings) mappings.lspconfig = nil - for _, section_mappings in pairs(mappings) do - -- skip mapping this as its mapppings are loaded in lspconfig - for mode, mode_mappings in pairs(section_mappings) do - for keybind, mapping_info in pairs(mode_mappings) do + for _, section in pairs(mappings) do + for mode, mode_values in pairs(section) do + for keybind, mapping_info in pairs(mode_values) 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 {}) + mapping_info.opts = nil - if mapping_info.opts then - mapping_info.opts = nil - end - - map_func(keybind, mapping_info, opts) + set_maps(keybind, mapping_info, opts) end end end @@ -127,7 +122,6 @@ M.merge_plugins = function(default_plugins) for key, _ in pairs(default_plugins) do default_plugins[key][1] = key - final_table[#final_table + 1] = default_plugins[key] end diff --git a/lua/plugins/configs/treesitter.lua b/lua/plugins/configs/treesitter.lua index 8c0717f..563c8c6 100644 --- a/lua/plugins/configs/treesitter.lua +++ b/lua/plugins/configs/treesitter.lua @@ -10,7 +10,6 @@ require("base46").load_highlight "treesitter" local options = { ensure_installed = { "lua", - "vim", }, highlight = { enable = true,