]> granicus.if.org Git - vim/commitdiff
patch 8.2.0360: yaml files are only recognized by the file extension v8.2.0360
authorBram Moolenaar <Bram@vim.org>
Fri, 6 Mar 2020 21:25:56 +0000 (22:25 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 6 Mar 2020 21:25:56 +0000 (22:25 +0100)
Problem:    Yaml files are only recognized by the file extension.
Solution:   Check for a line starting with "%YAML". (Jason Franklin)

runtime/scripts.vim
src/testdir/test_filetype.vim
src/version.c

index a690431014e496bbf8750edf89ae0eb6f9ab3ee2..c552f0202f2c64edf3708e50201e3db95cc224ea 100644 (file)
@@ -376,6 +376,10 @@ else
   elseif s:line1 =~? '-\*-.*erlang.*-\*-'
     set ft=erlang
 
+  " YAML
+  elseif s:line1 =~# '^%YAML'
+    set ft=yaml
+
   " CVS diff
   else
     let s:lnum = 1
index 7ea1a7427a4426f0db636482da01e81857b117bf..4531b2ade6fa56abeef689eff276b9d9e649c233 100644 (file)
@@ -601,6 +601,7 @@ let s:script_checks = {
       \ 'haskell': [['#!/path/haskell']],
       \ 'cpp': [['// Standard iostream objects -*- C++ -*-'],
       \         ['// -*- C++ -*-']],
+      \ 'yaml': [['%YAML 1.2']],
       \ }
 
 func Test_script_detection()
index e6c6bc94de14d36343f4c853c07c4290d27e8eb4..608532006d5fe7d59508751cc66d5731325859fc 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    360,
 /**/
     359,
 /**/