I found that YAML indent file is incorrect in some cases: specifically
s:FindPrevLessIndentedLine incorrectly ignores some non-comment line
while finding comment lines, `#key:` line may be considered a valid
mapping entry, indent script may think that line that follows `key: ~`
is a part of the value (here `~` is a value). Attached is a new
version of the file. Below is the diff.

```Patch
--- /home/zyx/.local-vim/share/vim/vim74/indent/yaml.vim 2016-08-05
05:57:26.107331456 +0300
+++ .vim/indent/yaml.vim 2016-08-14 02:46:09.163680104 +0300
@@ -37,7 +37,7 @@
     let curindent = a:0 ? a:1 : indent(a:lnum)
     while           prevlnum
                 \&&  indent(prevlnum) >=  curindent
-                \&& getline(prevlnum) !~# '^\s*#'
+                \&& getline(prevlnum) =~# '^\s*#'
         let prevlnum = prevnonblank(prevlnum-1)
     endwhile
     return prevlnum
@@ -51,11 +51,33 @@
     return plilnum
 endfunction

-let s:mapkeyregex='\v^\s*%(\''%([^'']|'''')*\'''.
-                \        '|\"%([^"\\]|\\.)*\"'.
-                \        '|%(%(\:\ )@!.)*)\:%(\ |$)'
+let s:mapkeyregex='\v^\s*\#@!\S@=%(\''%([^'']|\''\'')*\'''.
+                \                 '|\"%([^"\\]|\\.)*\"'.
+                \                 '|%(%(\:\ )@!.)*)\:%(\ |$)'
 let s:liststartregex='\v^\s*%(\-%(\ |$))'

+let s:c_ns_anchor_char = '\v%([\n\r\uFEFF \t,[\]{}]@!\p)'
+let s:c_ns_anchor_name = s:c_ns_anchor_char.'+'
+let s:c_ns_anchor_property =  '\v\&'.s:c_ns_anchor_name
+
+let s:ns_word_char = '\v[[:alnum:]_\-]'
+let s:ns_tag_char  = '\v%(%\x\x|'.s:ns_word_char.'|[#/;?:@&=+$.~*''()])'
+let s:c_named_tag_handle     = '\v\!'.s:ns_word_char.'+\!'
+let s:c_secondary_tag_handle = '\v\!\!'
+let s:c_primary_tag_handle   = '\v\!'
+let s:c_tag_handle = '\v%('.s:c_named_tag_handle.
+            \            '|'.s:c_secondary_tag_handle.
+            \            '|'.s:c_primary_tag_handle.')'
+let s:c_ns_shorthand_tag = '\v'.s:c_tag_handle . s:ns_tag_char.'+'
+let s:c_non_specific_tag = '\v\!'
+let s:ns_uri_char  = '\v%(%\x\x|'.s:ns_word_char.'\v|[#/;?:@&=+$,.!~*''()[\]])'
+let s:c_verbatim_tag = '\v\!\<'.s:ns_uri_char.'+\>'
+let s:c_ns_tag_property = '\v'.s:c_verbatim_tag.
+            \               '\v|'.s:c_ns_shorthand_tag.
+            \               '\v|'.s:c_non_specific_tag
+
+let s:block_scalar_header = '\v[|>]%([+-]?[1-9]|[1-9]?[+-])?'
+
 function GetYAMLIndent(lnum)
     if a:lnum == 1 || !prevnonblank(a:lnum-1)
         return 0
@@ -127,7 +149,10 @@
         " - List with
         "   multiline scalar
         return previndent+2
-    elseif prevline =~# s:mapkeyregex
+    elseif prevline =~# s:mapkeyregex . '\v\s*%(%('.s:c_ns_tag_property.
+                \                              '\v|'.s:c_ns_anchor_property.
+                \                              '\v|'.s:block_scalar_header.
+                \                             '\v)%(\s+|\s*%(\#.*)?$))*'
         " Mapping with: value
         "     that is multiline scalar
         return previndent+s:shiftwidth()
```

-- 
-- 
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].
For more options, visit https://groups.google.com/d/optout.

Attachment: yaml.vim
Description: Binary data

Raspunde prin e-mail lui