fix: always lazy load keymaps. fixes #1485
This commit is contained in:
@ -98,22 +98,23 @@ function M.setup(opts)
|
|||||||
error("Exiting")
|
error("Exiting")
|
||||||
end
|
end
|
||||||
|
|
||||||
if vim.fn.argc(-1) == 0 then
|
-- autocmds can be loaded lazily when not opening a file
|
||||||
-- autocmds and keymaps can wait to load
|
local lazy_autocmds = vim.fn.argc(-1) == 0
|
||||||
vim.api.nvim_create_autocmd("User", {
|
if not lazy_autocmds then
|
||||||
group = vim.api.nvim_create_augroup("LazyVim", { clear = true }),
|
|
||||||
pattern = "VeryLazy",
|
|
||||||
callback = function()
|
|
||||||
M.load("autocmds")
|
|
||||||
M.load("keymaps")
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
else
|
|
||||||
-- load them now so they affect the opened buffers
|
|
||||||
M.load("autocmds")
|
M.load("autocmds")
|
||||||
M.load("keymaps")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
group = vim.api.nvim_create_augroup("LazyVim", { clear = true }),
|
||||||
|
pattern = "VeryLazy",
|
||||||
|
callback = function()
|
||||||
|
if lazy_autocmds then
|
||||||
|
M.load("autocmds")
|
||||||
|
end
|
||||||
|
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
|
||||||
M.colorscheme()
|
M.colorscheme()
|
||||||
|
Reference in New Issue
Block a user