vim-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 vim/vim#1679,
            closes vim/vim#1693)

3e54569b17
This commit is contained in:
Justin M. Keyes
2018-02-03 11:58:44 +01:00
parent a1ee06a099
commit 16a4168364
4 changed files with 80 additions and 10 deletions

View File

@@ -9743,13 +9743,20 @@ void filetype_maybe_enable(void)
}
}
/*
* ":setfiletype {name}"
*/
/// ":setfiletype [FALLBACK] {name}"
static void ex_setfiletype(exarg_T *eap)
{
if (!did_filetype) {
set_option_value("filetype", 0L, (char *)eap->arg, OPT_LOCAL);
char_u *arg = eap->arg;
if (STRNCMP(arg, "FALLBACK ", 9) == 0) {
arg += 9;
}
set_option_value("filetype", 0L, (char *)arg, OPT_LOCAL);
if (arg != eap->arg) {
did_filetype = false;
}
}
}