aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2022-04-23 17:57:38 +0200
committerGitHub <noreply@github.com>2022-04-23 17:57:38 +0200
commit5c53e29ca9f5e86dd905cae134c78aa341ead157 (patch)
tree93e7566b5faf8bf31c4f609429684e509e480ecf
parenta98cf154ed9a05f3a2bdfa6e354547c954d2f052 (diff)
downloadrneovim-5c53e29ca9f5e86dd905cae134c78aa341ead157.tar.gz
rneovim-5c53e29ca9f5e86dd905cae134c78aa341ead157.tar.bz2
rneovim-5c53e29ca9f5e86dd905cae134c78aa341ead157.zip
fix(ftdetect): source plugins in autogroup (#18237)
In `filetype.lua`, source runtime `ftdetect` scripts within the `filetypedetect` augroup, same as `filetype.vim` (and only do so if `g:did_load_ftdetect` does not exist).
-rw-r--r--runtime/filetype.lua12
1 files 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