fix(autocmds): load autocmds during startup when argc > 0. Fixes #34

This commit is contained in:
Folke Lemaitre 2023-01-11 13:00:16 +01:00
parent e405023530
commit 318b56c1c4
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -78,15 +78,21 @@ function M.setup(opts)
) )
end end
-- autocmds and keymaps can wait to load if vim.fn.argc() == 0 then
vim.api.nvim_create_autocmd("User", { -- autocmds and keymaps can wait to load
group = vim.api.nvim_create_augroup("LazyVim", { clear = true }), vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy", group = vim.api.nvim_create_augroup("LazyVim", { clear = true }),
callback = function() pattern = "VeryLazy",
M.load("autocmds") callback = function()
M.load("keymaps") M.load("autocmds")
end, M.load("keymaps")
}) end,
})
else
-- load them now so they affect the opened buffers
M.load("autocmds")
M.load("keymaps")
end
require("lazy.core.util").try(function() require("lazy.core.util").try(function()
if type(M.colorscheme) == "function" then if type(M.colorscheme) == "function" then