feat: added support for `nvim --headless "+Lazy! sync" +qa`

This commit is contained in:
Folke Lemaitre 2022-12-21 22:28:09 +01:00
parent bc617474a0
commit 2e14a2f324
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
2 changed files with 25 additions and 21 deletions

View File

@ -116,6 +116,8 @@ M.me = nil
---@type string
M.mapleader = nil
M.headless = #vim.api.nvim_list_uis() == 0
---@param spec LazySpec
---@param opts? LazyConfig
function M.setup(spec, opts)
@ -153,12 +155,15 @@ function M.setup(spec, opts)
vim.go.loadplugins = false
M.mapleader = vim.g.mapleader
if M.headless then
require("lazy.view.commands").setup()
else
vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
once = true,
callback = function()
require("lazy.core.cache").autosave()
require("lazy.view").setup()
require("lazy.view.commands").setup()
if M.options.change_detection.enabled then
require("lazy.manage.reloader").enable()
end
@ -169,6 +174,7 @@ function M.setup(spec, opts)
end
end,
})
end
Util.very_lazy()
end

View File

@ -43,12 +43,10 @@ M.hover = "K"
---@type string?
M.mode = nil
function M.setup()
require("lazy.view.commands").setup()
require("lazy.view.colors").setup()
end
function M.show(mode)
if Config.headless then
return
end
M.mode = mode or M.mode or "home"
require("lazy.view.colors").setup()