From 508c8a597e658b88e5ed29d1fa6532875413ba7b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 2 May 2022 13:17:05 +0200 Subject: [PATCH] fix(ftdetect): source plugins in autogroup (#18362) (cherry picked from commit 244b371a18c8814295b2520b742544c830369613) Co-authored-by: Christian Clason --- runtime/filetype.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/runtime/filetype.lua b/runtime/filetype.lua index 8224b79534..47d55d8465 100644 --- a/runtime/filetype.lua +++ b/runtime/filetype.lua @@ -17,10 +17,14 @@ vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { }) -- These *must* be sourced after the autocommand above is created -vim.cmd [[ -runtime! ftdetect/*.vim -runtime! ftdetect/*.lua -]] +if not vim.g.did_load_ftdetect then + vim.cmd [[ + augroup filetypedetect + runtime! ftdetect/*.vim + runtime! ftdetect/*.lua + augroup END + ]] +end -- Set a marker so that the ftdetect scripts are not sourced a second time by filetype.vim vim.g.did_load_ftdetect = 1