mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-18 20:36:45 +00:00
feat(manage): added user events when operations finish. Fixes #135
This commit is contained in:
parent
3352fc6265
commit
a36d506393
4 changed files with 39 additions and 6 deletions
|
@ -48,6 +48,10 @@ function M.run(ropts, opts)
|
|||
vim.cmd([[do User LazyRender]])
|
||||
Plugin.update_state()
|
||||
require("lazy.manage.checker").fast_check({ report = false })
|
||||
local mode = opts.mode
|
||||
if mode then
|
||||
vim.cmd("do User Lazy" .. mode:sub(1, 1):upper() .. mode:sub(2))
|
||||
end
|
||||
end)
|
||||
|
||||
if opts.wait then
|
||||
|
@ -141,14 +145,27 @@ end
|
|||
|
||||
---@param opts? ManagerOpts
|
||||
function M.sync(opts)
|
||||
opts = M.opts(opts, { mode = "sync" })
|
||||
opts = M.opts(opts)
|
||||
if opts.clear then
|
||||
M.clear()
|
||||
opts.clear = false
|
||||
end
|
||||
M.clean(opts)
|
||||
M.install(opts)
|
||||
M.update(opts)
|
||||
if opts.show ~= false then
|
||||
vim.schedule(function()
|
||||
require("lazy.view").show("sync")
|
||||
end)
|
||||
opts.show = false
|
||||
end
|
||||
local clean = M.clean(opts)
|
||||
local install = M.install(opts)
|
||||
local update = M.update(opts)
|
||||
clean:wait(function()
|
||||
install:wait(function()
|
||||
update:wait(function()
|
||||
vim.cmd([[do User LazySync]])
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
---@param opts? ManagerOpts
|
||||
|
|
|
@ -139,7 +139,10 @@ end
|
|||
---@param cb? fun()
|
||||
function Runner:wait(cb)
|
||||
if #self._running == 0 then
|
||||
return cb and cb()
|
||||
if cb then
|
||||
cb()
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
if cb then
|
||||
|
@ -150,6 +153,7 @@ function Runner:wait(cb)
|
|||
vim.wait(10)
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
return Runner
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue