From 25305eca9252b1c4892af1fc15dce91339ee7691 Mon Sep 17 00:00:00 2001 From: siduck Date: Thu, 12 May 2022 19:27:11 +0530 Subject: [PATCH] clean up --- lua/core/default_config.lua | 1 - lua/core/mappings.lua | 2 +- lua/core/utils.lua | 14 ++++---------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/lua/core/default_config.lua b/lua/core/default_config.lua index e9a4804d..cdfc9c5a 100644 --- a/lua/core/default_config.lua +++ b/lua/core/default_config.lua @@ -20,7 +20,6 @@ M.options = { M.ui = { hl_override = {}, changed_themes = {}, - colors = {}, -- dynamically generated, never edit this in chadrc theme_toggle = { "onedark", "one_light" }, theme = "onedark", -- default theme transparency = false, diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index b849c1ba..85f57a94 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -52,7 +52,7 @@ M.bufferline = { n = { -- new buffer - ["n"] = { " enew ", "烙 new buffer" }, + [""] = { " enew ", "烙 new buffer" }, -- cycle through buffers [""] = { " BufferLineCycleNext ", " cycle next buffer" }, diff --git a/lua/core/utils.lua b/lua/core/utils.lua index 077970c2..10965b08 100644 --- a/lua/core/utils.lua +++ b/lua/core/utils.lua @@ -89,11 +89,13 @@ end -- remove plugins defined in chadrc nvchad.remove_default_plugins = function(plugins) local removals = nvchad.load_config().plugins.remove or {} + if not vim.tbl_isempty(removals) then for _, plugin in pairs(removals) do plugins[plugin] = nil end end + return plugins end @@ -101,16 +103,6 @@ end nvchad.plugin_list = function(default_plugins) local user_plugins = nvchad.load_config().plugins.user - -- require if string is present - local ok - - if type(user_plugins) == "string" then - ok, user_plugins = pcall(require, user_plugins) - if ok and not type(user_plugins) == "table" then - user_plugins = {} - end - end - -- merge default + user plugin table default_plugins = vim.tbl_deep_extend("force", default_plugins, user_plugins) @@ -127,10 +119,12 @@ end nvchad.load_override = function(default_table, plugin_name) local user_table = nvchad.load_config().plugins.override[plugin_name] + if type(user_table) == "table" then default_table = vim.tbl_deep_extend("force", default_table, user_table) else default_table = default_table end + return default_table end