fix(ftdetect): source ftdetect files only once. Fixes #235

This commit is contained in:
Folke Lemaitre 2022-12-29 22:40:15 +01:00
parent 717cd2f3d6
commit 9f3fb38402
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 8 additions and 3 deletions

View File

@ -11,6 +11,8 @@ M.loading = {}
M.init_done = false M.init_done = false
---@type table<string,true> ---@type table<string,true>
M.disabled_rtp_plugins = { packer_compiled = true } M.disabled_rtp_plugins = { packer_compiled = true }
---@type table<string,string>
M.did_ftdetect = {}
function M.setup() function M.setup()
-- setup handlers -- setup handlers
@ -243,9 +245,12 @@ end
---@param path string ---@param path string
function M.ftdetect(path) function M.ftdetect(path)
if not M.did_ftdetect[path] then
M.did_ftdetect[path] = path
vim.cmd("augroup filetypedetect") vim.cmd("augroup filetypedetect")
M.source_runtime(path, "ftdetect") M.source_runtime(path, "ftdetect")
vim.cmd("augroup END") vim.cmd("augroup END")
end
end end
---@param ... string ---@param ... string