aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/settings.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/settings.lua b/plugins/settings.lua
index 9186d84..9ae29b2 100644
--- a/plugins/settings.lua
+++ b/plugins/settings.lua
@@ -99,7 +99,8 @@ settings.option = {
---@param section string
---@param options settings.option[]
---@param plugin_name? string Optional name of plugin
-function settings.add(section, options, plugin_name)
+---@param overwrite? boolean Overwrite previous section options
+function settings.add(section, options, plugin_name, overwrite)
local category = ""
if plugin_name ~= nil then
category = "plugins"
@@ -107,6 +108,10 @@ function settings.add(section, options, plugin_name)
category = "core"
end
+ if overwrite and settings[category][section] then
+ settings[category][section] = {}
+ end
+
if not settings[category][section] then
settings[category][section] = {}
if category ~= "plugins" then
@@ -1100,6 +1105,11 @@ function Settings:enable_plugin(plugin)
require("plugins." .. plugin)
+ if config.plugins[plugin] and config.plugins[plugin].config_spec then
+ local conf = config.plugins[plugin].config_spec
+ settings.add(conf.name, conf, plugin, true)
+ end
+
for _, section in ipairs(settings.plugin_sections) do
local plugins = settings.plugins[section]