mirror of https://github.com/folke/lazy.nvim.git
fix(ft): always trigger FileType when lazy-loading on ft
This commit is contained in:
parent
b1e1b337a6
commit
5618076a45
|
@ -11,6 +11,7 @@ M.trigger_events = {
|
|||
BufRead = { "BufReadPre", "BufRead" },
|
||||
BufReadPost = { "BufReadPre", "BufRead", "BufReadPost" },
|
||||
}
|
||||
M.trigger_always = { "FileType" }
|
||||
M.group = vim.api.nvim_create_augroup("lazy_handler_event", { clear = true })
|
||||
|
||||
---@param value string
|
||||
|
@ -31,8 +32,12 @@ function M:_add(value)
|
|||
local groups = M.get_augroups(event, pattern)
|
||||
-- load the plugins
|
||||
Loader.load(self.active[value], { [self.type] = value })
|
||||
if vim.tbl_contains(M.trigger_always, event) then
|
||||
vim.cmd("do " .. event)
|
||||
else
|
||||
-- check if any plugin created an event handler for this event and fire the group
|
||||
M.trigger(event, pattern, groups)
|
||||
end
|
||||
Util.track()
|
||||
end,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue