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
opt.expandtab = true
opt.shiftwidth = 2
opt.shiftwidth = 3
opt.smartindent = true
opt.fillchars = { eob = " " }

View File

@ -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 {})
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

View File

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