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
This commit is contained in:
siduck 2022-07-12 21:54:25 +05:30
parent 86b3b6e96b
commit 5339bc42ae
3 changed files with 9 additions and 16 deletions

View file

@ -21,7 +21,7 @@ opt.cul = true -- cursor line
-- Indenting -- Indenting
opt.expandtab = true opt.expandtab = true
opt.shiftwidth = 2 opt.shiftwidth = 3
opt.smartindent = true opt.smartindent = true
opt.fillchars = { eob = " " } opt.fillchars = { eob = " " }

View file

@ -66,15 +66,15 @@ end
M.load_mappings = function(mappings, mapping_opt) M.load_mappings = function(mappings, mapping_opt)
-- set mapping function with/without whichkey -- set mapping function with/without whichkey
local map_func local set_maps
local whichkey_exists, wk = pcall(require, "which-key") local whichkey_exists, wk = pcall(require, "which-key")
if whichkey_exists then if whichkey_exists then
map_func = function(keybind, mapping_info, opts) set_maps = function(keybind, mapping_info, opts)
wk.register({ [keybind] = mapping_info }, opts) wk.register({ [keybind] = mapping_info }, opts)
end end
else else
map_func = function(keybind, mapping_info, opts) set_maps = function(keybind, mapping_info, opts)
local mode = opts.mode local mode = opts.mode
opts.mode = nil opts.mode = nil
vim.keymap.set(mode, keybind, mapping_info[1], opts) 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 = mappings or vim.deepcopy(M.load_config().mappings)
mappings.lspconfig = nil mappings.lspconfig = nil
for _, section_mappings in pairs(mappings) do for _, section in pairs(mappings) do
-- skip mapping this as its mapppings are loaded in lspconfig for mode, mode_values in pairs(section) do
for mode, mode_mappings in pairs(section_mappings) do for keybind, mapping_info in pairs(mode_values) do
for keybind, mapping_info in pairs(mode_mappings) do
-- merge default + user opts -- merge default + user opts
local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {}) local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {})
local opts = merge_tb("force", default_opts, mapping_info.opts or {}) local opts = merge_tb("force", default_opts, mapping_info.opts or {})
if mapping_info.opts then
mapping_info.opts = nil mapping_info.opts = nil
end
map_func(keybind, mapping_info, opts) set_maps(keybind, mapping_info, opts)
end end
end end
end end
@ -127,7 +122,6 @@ M.merge_plugins = function(default_plugins)
for key, _ in pairs(default_plugins) do for key, _ in pairs(default_plugins) do
default_plugins[key][1] = key default_plugins[key][1] = key
final_table[#final_table + 1] = default_plugins[key] final_table[#final_table + 1] = default_plugins[key]
end end

View file

@ -10,7 +10,6 @@ require("base46").load_highlight "treesitter"
local options = { local options = {
ensure_installed = { ensure_installed = {
"lua", "lua",
"vim",
}, },
highlight = { highlight = {
enable = true, enable = true,