fix(config): dont start checker/change_detection when running headless

This commit is contained in:
Folke Lemaitre 2024-06-26 11:10:43 +02:00
parent aa1c9572aa
commit 2aa8e061f2
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 30 additions and 30 deletions

View File

@ -272,10 +272,6 @@ function M.setup(opts)
M.mapleader = vim.g.mapleader
M.maplocalleader = vim.g.maplocalleader
if M.headless() then
require("lazy.view.commands").setup()
end
vim.api.nvim_create_autocmd("UIEnter", {
once = true,
callback = function()
@ -283,33 +279,37 @@ function M.setup(opts)
end,
})
vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
once = true,
callback = function()
require("lazy.view.commands").setup()
if M.options.change_detection.enabled then
require("lazy.manage.reloader").enable()
end
if M.options.checker.enabled then
vim.defer_fn(function()
require("lazy.manage.checker").start()
end, 10)
end
if M.headless() then
require("lazy.view.commands").setup()
else
vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
once = true,
callback = function()
require("lazy.view.commands").setup()
if M.options.change_detection.enabled then
require("lazy.manage.reloader").enable()
end
if M.options.checker.enabled then
vim.defer_fn(function()
require("lazy.manage.checker").start()
end, 10)
end
-- useful for plugin developers when making changes to a packspec file
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = { "lazy.lua", "pkg.json", "*.rockspec" },
callback = function()
require("lazy").pkg({
plugins = {
require("lazy.core.plugin").find(vim.uv.cwd() .. "/lua/"),
},
})
end,
})
end,
})
-- useful for plugin developers when making changes to a packspec file
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = { "lazy.lua", "pkg.json", "*.rockspec" },
callback = function()
require("lazy").pkg({
plugins = {
require("lazy.core.plugin").find(vim.uv.cwd() .. "/lua/"),
},
})
end,
})
end,
})
end
Util.very_lazy()
end