mirror of https://github.com/folke/lazy.nvim.git
feat: added support for `nvim --headless "+Lazy! sync" +qa`
This commit is contained in:
parent
bc617474a0
commit
2e14a2f324
|
@ -116,6 +116,8 @@ M.me = nil
|
||||||
---@type string
|
---@type string
|
||||||
M.mapleader = nil
|
M.mapleader = nil
|
||||||
|
|
||||||
|
M.headless = #vim.api.nvim_list_uis() == 0
|
||||||
|
|
||||||
---@param spec LazySpec
|
---@param spec LazySpec
|
||||||
---@param opts? LazyConfig
|
---@param opts? LazyConfig
|
||||||
function M.setup(spec, opts)
|
function M.setup(spec, opts)
|
||||||
|
@ -153,22 +155,26 @@ function M.setup(spec, opts)
|
||||||
vim.go.loadplugins = false
|
vim.go.loadplugins = false
|
||||||
M.mapleader = vim.g.mapleader
|
M.mapleader = vim.g.mapleader
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("User", {
|
if M.headless then
|
||||||
pattern = "VeryLazy",
|
require("lazy.view.commands").setup()
|
||||||
once = true,
|
else
|
||||||
callback = function()
|
vim.api.nvim_create_autocmd("User", {
|
||||||
require("lazy.core.cache").autosave()
|
pattern = "VeryLazy",
|
||||||
require("lazy.view").setup()
|
once = true,
|
||||||
if M.options.change_detection.enabled then
|
callback = function()
|
||||||
require("lazy.manage.reloader").enable()
|
require("lazy.core.cache").autosave()
|
||||||
end
|
require("lazy.view.commands").setup()
|
||||||
if M.options.checker.enabled then
|
if M.options.change_detection.enabled then
|
||||||
vim.defer_fn(function()
|
require("lazy.manage.reloader").enable()
|
||||||
require("lazy.manage.checker").start()
|
end
|
||||||
end, 10)
|
if M.options.checker.enabled then
|
||||||
end
|
vim.defer_fn(function()
|
||||||
end,
|
require("lazy.manage.checker").start()
|
||||||
})
|
end, 10)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
Util.very_lazy()
|
Util.very_lazy()
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,12 +43,10 @@ M.hover = "K"
|
||||||
---@type string?
|
---@type string?
|
||||||
M.mode = nil
|
M.mode = nil
|
||||||
|
|
||||||
function M.setup()
|
|
||||||
require("lazy.view.commands").setup()
|
|
||||||
require("lazy.view.colors").setup()
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.show(mode)
|
function M.show(mode)
|
||||||
|
if Config.headless then
|
||||||
|
return
|
||||||
|
end
|
||||||
M.mode = mode or M.mode or "home"
|
M.mode = mode or M.mode or "home"
|
||||||
require("lazy.view.colors").setup()
|
require("lazy.view.colors").setup()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue