feat: added Pre events. Fixes #856. Fixes #877

This commit is contained in:
Folke Lemaitre 2023-06-17 08:37:33 +02:00
parent 10d4371745
commit 0bca18de5d
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 14 additions and 3 deletions

View file

@ -18,6 +18,13 @@ local M = {}
function M.run(ropts, opts)
opts = opts or {}
local mode = opts.mode
local event = mode and ("Lazy" .. mode:sub(1, 1):upper() .. mode:sub(2))
if event then
vim.api.nvim_exec_autocmds("User", { pattern = event .. "Pre", modeline = false })
end
if opts.plugins then
---@param plugin string|LazyPlugin
opts.plugins = vim.tbl_map(function(plugin)
@ -49,9 +56,7 @@ function M.run(ropts, opts)
vim.api.nvim_exec_autocmds("User", { pattern = "LazyRender", modeline = false })
Plugin.update_state()
require("lazy.manage.checker").fast_check({ report = false })
local mode = opts.mode
if mode then
local event = "Lazy" .. mode:sub(1, 1):upper() .. mode:sub(2)
if event then
vim.api.nvim_exec_autocmds("User", { pattern = event, modeline = false })
end
end)