diff src/ex_docmd.c @ 11459:561b76ed9d12 v8.0.0613

patch 8.0.0613: the conf filetype is used before ftdetect from packages commit https://github.com/vim/vim/commit/3e54569b17683318e0cb6693ab0024c2ad1e3e8f Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 4 19:00:32 2017 +0200 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)
author Christian Brabandt <cb@256bit.org>
date Sun, 04 Jun 2017 19:15:03 +0200
parents 346168f2a6cb
children 6fff8b86e9bd
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -12172,13 +12172,22 @@ ex_filetype(exarg_T *eap)
 }
 
 /*
- * ":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