fixed chadrc string overrides calling default function parameter. Added ability to use function as config override

This commit is contained in:
zbirenbaum 2022-01-21 16:31:58 -05:00 committed by siduck
parent bccd8e4ab9
commit 4077ff3520

View File

@ -247,14 +247,17 @@ end
-- if 3rd arg not given, then return "require('plugins.configs.telescope')" -- if 3rd arg not given, then return "require('plugins.configs.telescope')"
-- if override is a table, mark set the override flag for the default config to true -- if override is a table, mark set the override flag for the default config to true
-- override flag being true tells the plugin to call tbl_override_req as part of configuration -- override flag being true tells the plugin to call tbl_override_req as part of configuration
M.override_req = function(name, default_config, config_function) M.override_req = function(name, default_config, config_function)
local override, apply_table_override = local override, apply_table_override =
require("core.utils").load_config().plugins.default_plugin_config_replace[name], "false" require("core.utils").load_config().plugins.default_plugin_config_replace[name], "false"
local result = default_config local result = default_config
if type(override) == "string" and override ~= "" then if type(override) == "string" and override ~= "" then
result = override return "require('" .. override .. "')"
elseif type(override) == "table" then elseif type(override) == "table" then
apply_table_override = "true" apply_table_override = "true"
elseif type(override) == "function" then
return override
end end
result = "('" .. result .. "')" result = "('" .. result .. "')"