Mercurial > vim
comparison runtime/indent/yaml.vim @ 29236:0eef32b4ebbc
Update runtime files
Commit: https://github.com/vim/vim/commit/d799daa660b8821943cbe1682f00da9e812dd48c
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jun 20 11:17:32 2022 +0100
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 20 Jun 2022 12:30:06 +0200 |
parents | b96ceb97e896 |
children | ebed259f919f |
comparison
equal
deleted
inserted
replaced
29235:fbcbc953c2ec | 29236:0eef32b4ebbc |
---|---|
1 " Vim indent file | 1 " Vim indent file |
2 " Language: YAML | 2 " Language: YAML |
3 " Maintainer: Nikolai Pavlov <zyx.vim@gmail.com> | 3 " Maintainer: Nikolai Pavlov <zyx.vim@gmail.com> |
4 " Last Update: Lukas Reineke | 4 " Last Update: Lukas Reineke |
5 " Last Change: 2022 May 02 | 5 " Last Change: 2022 Jun 17 |
6 | 6 |
7 " Only load this indent file when no other was loaded. | 7 " Only load this indent file when no other was loaded. |
8 if exists('b:did_indent') | 8 if exists('b:did_indent') |
9 finish | 9 finish |
10 endif | 10 endif |
42 let plilnum = s:FindPrevLessIndentedLine(plilnum) | 42 let plilnum = s:FindPrevLessIndentedLine(plilnum) |
43 endwhile | 43 endwhile |
44 return plilnum | 44 return plilnum |
45 endfunction | 45 endfunction |
46 | 46 |
47 let s:mapkeyregex='\v^\s*\#@!\S@=%(\''%([^'']|\''\'')*\'''. | 47 let s:mapkeyregex = '\v^\s*\#@!\S@=%(\''%([^'']|\''\'')*\''' .. |
48 \ '|\"%([^"\\]|\\.)*\"'. | 48 \ '|\"%([^"\\]|\\.)*\"' .. |
49 \ '|%(%(\:\ )@!.)*)\:%(\ |$)' | 49 \ '|%(%(\:\ )@!.)*)\:%(\ |$)' |
50 let s:liststartregex='\v^\s*%(\-%(\ |$))' | 50 let s:liststartregex = '\v^\s*%(\-%(\ |$))' |
51 | 51 |
52 let s:c_ns_anchor_char = '\v%([\n\r\uFEFF \t,[\]{}]@!\p)' | 52 let s:c_ns_anchor_char = '\v%([\n\r\uFEFF \t,[\]{}]@!\p)' |
53 let s:c_ns_anchor_name = s:c_ns_anchor_char.'+' | 53 let s:c_ns_anchor_name = s:c_ns_anchor_char .. '+' |
54 let s:c_ns_anchor_property = '\v\&'.s:c_ns_anchor_name | 54 let s:c_ns_anchor_property = '\v\&' .. s:c_ns_anchor_name |
55 | 55 |
56 let s:ns_word_char = '\v[[:alnum:]_\-]' | 56 let s:ns_word_char = '\v[[:alnum:]_\-]' |
57 let s:ns_tag_char = '\v%(%\x\x|'.s:ns_word_char.'|[#/;?:@&=+$.~*''()])' | 57 let s:ns_tag_char = '\v%(%\x\x|' .. s:ns_word_char .. '|[#/;?:@&=+$.~*''()])' |
58 let s:c_named_tag_handle = '\v\!'.s:ns_word_char.'+\!' | 58 let s:c_named_tag_handle = '\v\!' .. s:ns_word_char .. '+\!' |
59 let s:c_secondary_tag_handle = '\v\!\!' | 59 let s:c_secondary_tag_handle = '\v\!\!' |
60 let s:c_primary_tag_handle = '\v\!' | 60 let s:c_primary_tag_handle = '\v\!' |
61 let s:c_tag_handle = '\v%('.s:c_named_tag_handle. | 61 let s:c_tag_handle = '\v%(' .. s:c_named_tag_handle. |
62 \ '|'.s:c_secondary_tag_handle. | 62 \ '|' .. s:c_secondary_tag_handle. |
63 \ '|'.s:c_primary_tag_handle.')' | 63 \ '|' .. s:c_primary_tag_handle .. ')' |
64 let s:c_ns_shorthand_tag = '\v'.s:c_tag_handle . s:ns_tag_char.'+' | 64 let s:c_ns_shorthand_tag = '\v' .. s:c_tag_handle .. s:ns_tag_char .. '+' |
65 let s:c_non_specific_tag = '\v\!' | 65 let s:c_non_specific_tag = '\v\!' |
66 let s:ns_uri_char = '\v%(%\x\x|'.s:ns_word_char.'\v|[#/;?:@&=+$,.!~*''()[\]])' | 66 let s:ns_uri_char = '\v%(%\x\x|' .. s:ns_word_char .. '\v|[#/;?:@&=+$,.!~*''()[\]])' |
67 let s:c_verbatim_tag = '\v\!\<'.s:ns_uri_char.'+\>' | 67 let s:c_verbatim_tag = '\v\!\<' .. s:ns_uri_char.. '+\>' |
68 let s:c_ns_tag_property = '\v'.s:c_verbatim_tag. | 68 let s:c_ns_tag_property = '\v' .. s:c_verbatim_tag. |
69 \ '\v|'.s:c_ns_shorthand_tag. | 69 \ '\v|' .. s:c_ns_shorthand_tag. |
70 \ '\v|'.s:c_non_specific_tag | 70 \ '\v|' .. s:c_non_specific_tag |
71 | 71 |
72 let s:block_scalar_header = '\v[|>]%([+-]?[1-9]|[1-9]?[+-])?' | 72 let s:block_scalar_header = '\v[|>]%([+-]?[1-9]|[1-9]?[+-])?' |
73 | 73 |
74 function GetYAMLIndent(lnum) | 74 function GetYAMLIndent(lnum) |
75 if a:lnum == 1 || !prevnonblank(a:lnum-1) | 75 if a:lnum == 1 || !prevnonblank(a:lnum-1) |
140 endif | 140 endif |
141 elseif prevline =~# '^\s*- ' | 141 elseif prevline =~# '^\s*- ' |
142 " - List with | 142 " - List with |
143 " multiline scalar | 143 " multiline scalar |
144 return previndent+2 | 144 return previndent+2 |
145 elseif prevline =~# s:mapkeyregex . '\v\s*%(%('.s:c_ns_tag_property. | 145 elseif prevline =~# s:mapkeyregex .. '\v\s*%(%(' .. s:c_ns_tag_property .. |
146 \ '\v|'.s:c_ns_anchor_property. | 146 \ '\v|' .. s:c_ns_anchor_property .. |
147 \ '\v|'.s:block_scalar_header. | 147 \ '\v|' .. s:block_scalar_header .. |
148 \ '\v)%(\s+|\s*%(\#.*)?$))*' | 148 \ '\v)%(\s+|\s*%(\#.*)?$))*' |
149 " Mapping with: value | 149 " Mapping with: value |
150 " that is multiline scalar | 150 " that is multiline scalar |
151 return previndent+shiftwidth() | 151 return previndent+shiftwidth() |
152 endif | 152 endif |