mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-18 20:36:45 +00:00
fix(ft): fix ft handlers to properly use new events. Fixes #1084
This commit is contained in:
parent
6687afae42
commit
e4ea874e33
2 changed files with 33 additions and 21 deletions
|
@ -20,21 +20,21 @@ function M:add(plugin)
|
|||
end
|
||||
end
|
||||
|
||||
---@param pattern? string
|
||||
function M:trigger(_, pattern, _)
|
||||
for _, group in ipairs({ "filetypeplugin", "filetypeindent" }) do
|
||||
Util.try(function()
|
||||
if Config.options.debug then
|
||||
Util.info({
|
||||
"# Firing Events",
|
||||
" - **group:** `" .. group .. "`",
|
||||
" - **event:** FileType",
|
||||
pattern and (" - **pattern:** " .. pattern),
|
||||
})
|
||||
end
|
||||
vim.api.nvim_exec_autocmds("FileType", { group = group, modeline = false, pattern = pattern })
|
||||
end)
|
||||
end
|
||||
---@param opts LazyEventOpts
|
||||
function M:_trigger(opts)
|
||||
Util.try(function()
|
||||
if Config.options.debug then
|
||||
Util.info({
|
||||
"# Firing Events",
|
||||
" - **event:** FileType",
|
||||
opts.pattern and (" - **pattern:** " .. opts.pattern),
|
||||
opts.buf and (" - **buf:** " .. opts.buf),
|
||||
})
|
||||
end
|
||||
Util.track({ event = "FileType" })
|
||||
vim.api.nvim_exec_autocmds("FileType", { modeline = false, buffer = opts.buf })
|
||||
Util.track()
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue