feat: filetype.lua (#16600)

Adds a new vim.filetype module that provides support for filetype detection in
Lua.
This commit is contained in:
Gregory Anders
2022-01-04 07:28:29 -07:00
committed by GitHub
parent cc62f3d6cb
commit 3fd454bd4a
13 changed files with 1938 additions and 21 deletions

View File

@@ -9551,15 +9551,18 @@ static void ex_filetype(exarg_T *eap)
void filetype_maybe_enable(void)
{
if (filetype_detect == kNone) {
source_runtime(FILETYPE_FILE, true);
// Normally .vim files are sourced before .lua files when both are
// supported, but we reverse the order here because we want the Lua
// autocommand to be defined first so that it runs first
source_runtime(FILETYPE_FILE, DIP_ALL);
filetype_detect = kTrue;
}
if (filetype_plugin == kNone) {
source_runtime(FTPLUGIN_FILE, true);
source_runtime(FTPLUGIN_FILE, DIP_ALL);
filetype_plugin = kTrue;
}
if (filetype_indent == kNone) {
source_runtime(INDENT_FILE, true);
source_runtime(INDENT_FILE, DIP_ALL);
filetype_indent = kTrue;
}
}