Skip to content

Commit 9f3fb38

Browse files
committed
fix(ftdetect): source ftdetect files only once. Fixes #235
1 parent 717cd2f commit 9f3fb38

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lua/lazy/core/loader.lua

+8-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ M.loading = {}
1111
M.init_done = false
1212
---@type table<string,true>
1313
M.disabled_rtp_plugins = { packer_compiled = true }
14+
---@type table<string,string>
15+
M.did_ftdetect = {}
1416

1517
function M.setup()
1618
-- setup handlers
@@ -243,9 +245,12 @@ end
243245

244246
---@param path string
245247
function M.ftdetect(path)
246-
vim.cmd("augroup filetypedetect")
247-
M.source_runtime(path, "ftdetect")
248-
vim.cmd("augroup END")
248+
if not M.did_ftdetect[path] then
249+
M.did_ftdetect[path] = path
250+
vim.cmd("augroup filetypedetect")
251+
M.source_runtime(path, "ftdetect")
252+
vim.cmd("augroup END")
253+
end
249254
end
250255

251256
---@param ... string

0 commit comments

Comments
 (0)