patch 8.0.0613: the conf filetype is used before ftdetect from packages
Problem: The conf filetype detection is done before ftdetect scripts from
packages that are added later.
Solution: Add the FALLBACK argument to :setfiletype. (closes #1679,
closes #1693)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 13d5fe4..2c9c878 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -12172,13 +12172,22 @@
}
/*
- * ":setfiletype {name}"
+ * ":setfiletype [FALLBACK] {name}"
*/
static void
ex_setfiletype(exarg_T *eap)
{
if (!did_filetype)
- set_option_value((char_u *)"filetype", 0L, eap->arg, OPT_LOCAL);
+ {
+ char_u *arg = eap->arg;
+
+ if (STRNCMP(arg, "FALLBACK ", 9) == 0)
+ arg += 9;
+
+ set_option_value((char_u *)"filetype", 0L, arg, OPT_LOCAL);
+ if (arg != eap->arg)
+ did_filetype = FALSE;
+ }
}
#endif