diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-08-16 18:33:43 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-08-16 18:33:43 +0200 |
commit | dc1f1645cb495fa6bfbe216d7359f23539a0e25d (patch) | |
tree | 8506c408b47f94f6cbee30aeb4ce4f15d7c7d2f5 /runtime/indent/yaml.vim | |
parent | 4f416e41243ca151b95d39d81ce23d00b1484755 (diff) |
Updated runtime files.
Diffstat (limited to 'runtime/indent/yaml.vim')
-rw-r--r-- | runtime/indent/yaml.vim | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim index aa4906ce0a..3201462fbc 100644 --- a/runtime/indent/yaml.vim +++ b/runtime/indent/yaml.vim @@ -37,7 +37,7 @@ function s:FindPrevLessIndentedLine(lnum, ...) 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 @@ function s:FindPrevLEIndentedLineMatchingRegex(lnum, regex) 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 @@ function GetYAMLIndent(lnum) " - 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() |