fix(config-loader): defer invalid configuration warning (#3869)

This commit is contained in:
LostNeophyte 2023-02-25 12:24:12 +01:00 committed by GitHub
parent 5951c431e6
commit a7e7f28639
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23

View file

@ -51,11 +51,15 @@ function M:load(config_path)
local ok, err = pcall(dofile, config_path)
if not ok then
if utils.is_file(user_config_file) then
vim.schedule(function()
Log:warn("Invalid configuration: " .. err)
end)
else
vim.schedule(function()
vim.notify_once(
string.format("User-configuration not found. Creating an example configuration in %s", config_path)
)
end)
local config_name = vim.loop.os_uname().version:match "Windows" and "config_win" or "config"
local example_config = join_paths(get_lvim_base_dir(), "utils", "installer", config_name .. ".example.lua")
vim.fn.mkdir(user_config_dir, "p")