fix(ft): only trigger filetypepluing and filetypeindent for ft handler. Fixes #228

This commit is contained in:
Folke Lemaitre 2022-12-29 17:26:38 +01:00
parent db043da829
commit 7de662d037
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 20 additions and 9 deletions

View file

@ -1,4 +1,5 @@
local Event = require("lazy.core.handler.event")
local Util = require("lazy.core.util")
local Loader = require("lazy.core.loader")
---@class LazyFiletypeHandler:LazyEventHandler
@ -18,4 +19,19 @@ function M:add(plugin)
end
end
---@param pattern? string
function M:trigger(_, pattern, _)
for _, group in ipairs({ "filetypeplugin", "filetypeindent" }) do
Util.try(function()
Util.info({
"# Firing Events",
" - **group:** `" .. group .. "`",
" - **event:** FileType",
pattern and (" - **pattern:** " .. pattern),
})
vim.api.nvim_exec_autocmds("FileType", { group = group, modeline = false, pattern = pattern })
end)
end
end
return M