ensure errors arent silently swallowed in custom chadrc if exists
This commit is contained in:
parent
40c180d3b2
commit
78b2cc3106
1 changed files with 4 additions and 1 deletions
|
@ -3,9 +3,12 @@ local merge_tb = vim.tbl_deep_extend
|
||||||
|
|
||||||
M.load_config = function()
|
M.load_config = function()
|
||||||
local config = require "core.default_config"
|
local config = require "core.default_config"
|
||||||
local chadrc_exists, chadrc = pcall(require, "custom.chadrc")
|
|
||||||
|
-- nvim_get_runtime_file always uses forward slashes regardless of platform
|
||||||
|
local chadrc_exists = vim.api.nvim_get_runtime_file('lua/custom/chadrc.lua', false)[1]
|
||||||
|
|
||||||
if chadrc_exists then
|
if chadrc_exists then
|
||||||
|
local chadrc = require "custom.chadrc"
|
||||||
-- merge user config if it exists and is a table; otherwise display an error
|
-- merge user config if it exists and is a table; otherwise display an error
|
||||||
if type(chadrc) == "table" then
|
if type(chadrc) == "table" then
|
||||||
config.mappings = M.remove_disabled_keys(chadrc.mappings, config.mappings)
|
config.mappings = M.remove_disabled_keys(chadrc.mappings, config.mappings)
|
||||||
|
|
Loading…
Reference in a new issue