diff --git a/lua/core/utils.lua b/lua/core/utils.lua index 9c16c53..bfda660 100644 --- a/lua/core/utils.lua +++ b/lua/core/utils.lua @@ -141,12 +141,16 @@ end M.load_config = function() local conf = require "core.default_config" - local chadrcExists, change = pcall(require, "custom.chadrc") - - -- if chadrc exists , then merge its table into the default config's - - if chadrcExists then - conf = vim.tbl_deep_extend("force", conf, change) + -- attempt to load and merge a user config + local chadrc_exists = vim.fn.filereadable(vim.fn.stdpath "config" .. "/lua/custom/chadrc.lua") == 1 + if chadrc_exists then + -- merge user config if it exists and is a table; otherwise display an error + local user_config = require "custom.chadrc" + if type(user_config) == 'table' then + conf = vim.tbl_deep_extend("force", conf, user_config) + else + error("User config (chadrc.lua) *must* return a table!") + end end return conf