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