Skip to content

Commit

Permalink
fix(ftdetect): source ftdetect files only once. Fixes #235
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 29, 2022
1 parent 717cd2f commit 9f3fb38
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lua/lazy/core/loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ M.loading = {}
M.init_done = false
---@type table<string,true>
M.disabled_rtp_plugins = { packer_compiled = true }
---@type table<string,string>
M.did_ftdetect = {}

function M.setup()
-- setup handlers
Expand Down Expand Up @@ -243,9 +245,12 @@ end

---@param path string
function M.ftdetect(path)
vim.cmd("augroup filetypedetect")
M.source_runtime(path, "ftdetect")
vim.cmd("augroup END")
if not M.did_ftdetect[path] then
M.did_ftdetect[path] = path
vim.cmd("augroup filetypedetect")
M.source_runtime(path, "ftdetect")
vim.cmd("augroup END")
end
end

---@param ... string
Expand Down

0 comments on commit 9f3fb38

Please sign in to comment.