diff options
author | kylo252 <[email protected]> | 2022-10-17 17:29:15 +0200 |
---|---|---|
committer | kylo252 <[email protected]> | 2022-10-17 17:29:15 +0200 |
commit | 4ef07315003f723bb8e97d5a91b2bde3773ec1b8 (patch) | |
tree | e9889a492f76e3f9573228343aaba647dfd48136 /lua/lvim/config/init.lua | |
parent | e4a5fe97abe500bbbe78fb137d57a59f558da05a (diff) | |
parent | 6f6cbc394d2a7e64964b6067a2f42d2e6a07824e (diff) |
Merge remote-tracking branch 'origin/rolling'
Diffstat (limited to 'lua/lvim/config/init.lua')
-rw-r--r-- | lua/lvim/config/init.lua | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/lua/lvim/config/init.lua b/lua/lvim/config/init.lua index c6765f56..59722673 100644 --- a/lua/lvim/config/init.lua +++ b/lua/lvim/config/init.lua @@ -111,45 +111,56 @@ end --- Override the configuration with a user provided one -- @param config_path The path to the configuration overrides function M:load(config_path) - local autocmds = require "lvim.core.autocmds" + local autocmds = reload "lvim.core.autocmds" config_path = config_path or self:get_user_config_path() local ok, err = pcall(dofile, config_path) if not ok then if utils.is_file(user_config_file) then Log:warn("Invalid configuration: " .. err) else - vim.notify_once(string.format("Unable to find configuration file [%s]", config_path), vim.log.levels.WARN) + vim.notify_once( + string.format("User-configuration not found. Creating an example configuration in %s", config_path) + ) + local example_config = join_paths(get_lvim_base_dir(), "utils", "installer", "config.example.lua") + vim.loop.fs_copyfile(example_config, config_path) end end + Log:set_level(lvim.log.level) + handle_deprecated_settings() autocmds.define_autocmds(lvim.autocommands) vim.g.mapleader = (lvim.leader == "space" and " ") or lvim.leader - require("lvim.keymappings").load(lvim.keys) + reload("lvim.keymappings").load(lvim.keys) if lvim.transparent_window then autocmds.enable_transparent_mode() end + + if lvim.reload_config_on_save then + autocmds.enable_reload_config_on_save() + end end --- Override the configuration with a user provided one -- @param config_path The path to the configuration overrides function M:reload() vim.schedule(function() - require_clean("lvim.utils.hooks").run_pre_reload() + reload("lvim.utils.hooks").run_pre_reload() M:load() - require("lvim.core.autocmds").configure_format_on_save() + reload("lvim.core.autocmds").configure_format_on_save() - local plugins = require "lvim.plugins" - local plugin_loader = require "lvim.plugin-loader" + local plugins = reload "lvim.plugins" + local plugin_loader = reload "lvim.plugin-loader" plugin_loader.reload { plugins, lvim.plugins } - require_clean("lvim.utils.hooks").run_post_reload() + reload("lvim.core.theme").setup() + reload("lvim.utils.hooks").run_post_reload() end) end |