refactor(config): moved loading of options, keymaps and autocmds to lazyvim.config

This commit is contained in:
Folke Lemaitre committed 2023-01-10 11:14:27 +01:00
1 parent 7b943822db
commit dcf520f3a7
4 files changed
+38 -34

No files matched your search

-33
View File
@@ -1,33 +0,0 @@
local function load(name)
local Util = require("lazy.core.util")
-- always load lazyvim, then user file
for _, mod in ipairs({ "lazyvim.config." .. name, "config." .. name }) do
Util.try(function()
require(mod)
end, {
msg = "Failed loading " .. mod,
on_error = function(msg)
local modpath = require("lazy.core.cache").find(mod)
if modpath then
Util.error(msg)
end
end,
})
end
end
-- load options here, before lazy init while sourcing plugin modules
-- this is needed to make sure options will be correctly applied
-- after installing missing plugins
load("options")
-- autocmds and keymaps can wait to load
vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
callback = function()
load("autocmds")
load("keymaps")
end,
})
return {}
+3 -1
View File
@@ -5,7 +5,9 @@ local specs = {
-- only add for >=9.0.1, since there's an endless loop in earlier versions
if require("lazyvim.config").has(">=9.1.0") then
specs[#specs + 1] = { "LazyVim/LazyVim", priority = 10000, lazy = true }
specs[#specs + 1] = { "LazyVim/LazyVim", priority = 10000, lazy = false, config = true }
else
require("lazyvim.config").setup()
end
return specs
+6
View File
@@ -0,0 +1,6 @@
-- load options here, before lazy init while sourcing plugin modules
-- this is needed to make sure options will be correctly applied
-- after installing missing plugins
require("lazyvim.config").load("options")
return {}