mirror of https://github.com/folke/lazy.nvim.git
fix: use `vim.api.nvim_exec_autocmds` instead of `vim.cmd[[do]]` to prevent weird `vim.notify` behavior
This commit is contained in:
parent
81017b99e7
commit
b73312aa32
|
@ -227,7 +227,7 @@ function M._load(plugin, reason, opts)
|
||||||
plugin._.loaded.time = Util.track().time
|
plugin._.loaded.time = Util.track().time
|
||||||
table.remove(M.loading)
|
table.remove(M.loading)
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
vim.cmd("do User LazyRender")
|
vim.api.nvim_exec_autocmds("User", { pattern = "LazyRender", modeline = false })
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ function M.very_lazy()
|
||||||
local function _load()
|
local function _load()
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
vim.g.did_very_lazy = true
|
vim.g.did_very_lazy = true
|
||||||
vim.cmd("do User VeryLazy")
|
vim.api.nvim_exec_autocmds("User", { pattern = "VeryLazy", modeline = false })
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ function M.setup(spec, opts)
|
||||||
Loader.startup()
|
Loader.startup()
|
||||||
|
|
||||||
-- all done!
|
-- all done!
|
||||||
vim.cmd("do User LazyDone")
|
vim.api.nvim_exec_autocmds("User", { pattern = "LazyDone", modeline = false })
|
||||||
require("lazy.stats").track("LazyDone")
|
require("lazy.stats").track("LazyDone")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -42,16 +42,17 @@ function M.run(ropts, opts)
|
||||||
local runner = Runner.new(ropts)
|
local runner = Runner.new(ropts)
|
||||||
runner:start()
|
runner:start()
|
||||||
|
|
||||||
vim.cmd([[do User LazyRender]])
|
vim.api.nvim_exec_autocmds("User", { pattern = "LazyRender", modeline = false })
|
||||||
|
|
||||||
-- wait for post-install to finish
|
-- wait for post-install to finish
|
||||||
runner:wait(function()
|
runner:wait(function()
|
||||||
vim.cmd([[do User LazyRender]])
|
vim.api.nvim_exec_autocmds("User", { pattern = "LazyRender", modeline = false })
|
||||||
Plugin.update_state()
|
Plugin.update_state()
|
||||||
require("lazy.manage.checker").fast_check({ report = false })
|
require("lazy.manage.checker").fast_check({ report = false })
|
||||||
local mode = opts.mode
|
local mode = opts.mode
|
||||||
if mode then
|
if mode then
|
||||||
vim.cmd("do User Lazy" .. mode:sub(1, 1):upper() .. mode:sub(2))
|
local event = "Lazy" .. mode:sub(1, 1):upper() .. mode:sub(2)
|
||||||
|
vim.api.nvim_exec_autocmds("User", { pattern = event, modeline = false })
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -179,7 +180,7 @@ function M.sync(opts)
|
||||||
clean:wait(function()
|
clean:wait(function()
|
||||||
install:wait(function()
|
install:wait(function()
|
||||||
update:wait(function()
|
update:wait(function()
|
||||||
vim.cmd([[do User LazySync]])
|
vim.api.nvim_exec_autocmds("User", { pattern = "LazySync", modeline = false })
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
@ -211,7 +212,7 @@ function M.clear(plugins)
|
||||||
end, plugin._.tasks)
|
end, plugin._.tasks)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
vim.cmd([[do User LazyRender]])
|
vim.api.nvim_exec_autocmds("User", { pattern = "LazyRender", modeline = false })
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -83,8 +83,8 @@ function M.check(start)
|
||||||
Util.warn(lines)
|
Util.warn(lines)
|
||||||
end
|
end
|
||||||
Plugin.load()
|
Plugin.load()
|
||||||
vim.cmd([[do User LazyRender]])
|
vim.api.nvim_exec_autocmds("User", { pattern = "LazyRender", modeline = false })
|
||||||
vim.cmd([[do User LazyReload]])
|
vim.api.nvim_exec_autocmds("User", { pattern = "LazyReload", modeline = false })
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,7 +85,7 @@ function Task:_check()
|
||||||
if self._opts.on_done then
|
if self._opts.on_done then
|
||||||
self._opts.on_done(self)
|
self._opts.on_done(self)
|
||||||
end
|
end
|
||||||
vim.cmd("do User LazyRender")
|
vim.api.nvim_exec_autocmds("User", { pattern = "LazyRender", modeline = false })
|
||||||
vim.api.nvim_exec_autocmds("User", {
|
vim.api.nvim_exec_autocmds("User", {
|
||||||
pattern = "LazyPlugin" .. self.name:sub(1, 1):upper() .. self.name:sub(2),
|
pattern = "LazyPlugin" .. self.name:sub(1, 1):upper() .. self.name:sub(2),
|
||||||
data = { plugin = self.plugin.name },
|
data = { plugin = self.plugin.name },
|
||||||
|
@ -131,7 +131,7 @@ function Task:spawn(cmd, opts)
|
||||||
if on_line then
|
if on_line then
|
||||||
pcall(on_line, line)
|
pcall(on_line, line)
|
||||||
end
|
end
|
||||||
vim.cmd("do User LazyRender")
|
vim.api.nvim_exec_autocmds("User", { pattern = "LazyRender", modeline = false })
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param output string
|
---@param output string
|
||||||
|
|
|
@ -21,7 +21,7 @@ M.C = nil
|
||||||
|
|
||||||
function M.on_ui_enter()
|
function M.on_ui_enter()
|
||||||
M._stats.startuptime = M.track("UIEnter")
|
M._stats.startuptime = M.track("UIEnter")
|
||||||
vim.cmd([[do User LazyVimStarted]])
|
vim.api.nvim_exec_autocmds("User", { pattern = "LazyVimStarted", modeline = false })
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.track(event)
|
function M.track(event)
|
||||||
|
|
|
@ -127,7 +127,7 @@ function M:mount()
|
||||||
config.style = self.opts.style ~= "" and self.opts.style or nil
|
config.style = self.opts.style ~= "" and self.opts.style or nil
|
||||||
vim.api.nvim_win_set_config(self.win, config)
|
vim.api.nvim_win_set_config(self.win, config)
|
||||||
opts()
|
opts()
|
||||||
vim.cmd([[do User LazyFloatResized]])
|
vim.api.nvim_exec_autocmds("User", { pattern = "LazyFloatResized", modeline = false })
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue