added helper functions for removing plugins from default plugin table
This commit is contained in:
parent
a3a5b506de
commit
4b68a75853
3 changed files with 24 additions and 1 deletions
|
@ -107,6 +107,8 @@ M.plugins = {
|
||||||
esc_insertmode_timeout = 300,
|
esc_insertmode_timeout = 300,
|
||||||
},
|
},
|
||||||
default_plugin_config_replace = {},
|
default_plugin_config_replace = {},
|
||||||
|
default_plugin_edit = {},
|
||||||
|
default_plugin_remove = {},
|
||||||
install = nil,
|
install = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,4 +280,23 @@ M.tbl_override_req = function(name, default_table)
|
||||||
return vim.tbl_deep_extend("force", default_table, override)
|
return vim.tbl_deep_extend("force", default_table, override)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Helper function to get key from default plugin table
|
||||||
|
local get_plugin_index = function(plugin_table, plugin_name)
|
||||||
|
for index, plugin in ipairs(plugin_table) do
|
||||||
|
if plugin[1] == plugin_name then
|
||||||
|
return index
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.remove_default_plugins = function(plugin_table)
|
||||||
|
local removals = require("core.utils").load_config().plugins.default_plugin_remove or {}
|
||||||
|
if vim.tbl_isempty(removals) then return plugin_table end
|
||||||
|
for _, plugin_removal in ipairs(removals) do
|
||||||
|
index = get_plugin_index(plugin_table, plugin_removal)
|
||||||
|
plugin_table[index] = nil
|
||||||
|
end
|
||||||
|
return plugin_table
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -226,7 +226,9 @@ local plugins = {
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
--Merge changes to plugin fields from chadrc
|
||||||
|
plugins = require("core.utils").edit_default_plugins(plugins)
|
||||||
|
plugins = require("core.utils").remove_default_plugins(plugins)
|
||||||
-- append user plugins to default plugins
|
-- append user plugins to default plugins
|
||||||
local user_Plugins = plugin_settings.install
|
local user_Plugins = plugin_settings.install
|
||||||
if type(user_Plugins) == "table" then
|
if type(user_Plugins) == "table" then
|
||||||
|
|
Loading…
Reference in a new issue