Greetings:

YAML files are only detected when they end in ".yml" or ".yaml".

The change below allows for YAML to be detected by content:

diff --git a/runtime/scripts.vim b/runtime/scripts.vim
index a69043101..71fc56a48 100644
--- a/runtime/scripts.vim
+++ b/runtime/scripts.vim
@@ -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

If a file begins with "---" we can assume that this is a YAML document
boundary symbol.  One may argue that this is not for sure, but it seems
unlikely to me that any other type of content would begin this way.

The other possibility is when some text begins with a YAML version
directive (e.g., "%YAML 1.2").  With this criteria we can be nearly
certain of the type.

This doesn't handle all cases.  However, it will catch far more
instances where the content of a file is YAML, yet the name doesn't
match what is expected.

Thanks!

-- 
Jason Franklin

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/27cda1b0-5a90-cb07-0256-d6d055c87f7f%40quoininc.com.

Raspunde prin e-mail lui