annotate runtime/indent/yaml.vim @ 26686:c04b28fad0cc v8.2.3872

patch 8.2.3872: Vim9: finddir() and uniq() return types can be more specific Commit: https://github.com/vim/vim/commit/080182216e605df3428cc699b9fd7e761368d12f Author: Bram Moolenaar <Bram@vim.org> Date: Wed Dec 22 18:45:37 2021 +0000 patch 8.2.3872: Vim9: finddir() and uniq() return types can be more specific Problem: Vim9: finddir() and uniq() return types can be more specific. Solution: Adjust the return type.
author Bram Moolenaar <Bram@vim.org>
date Wed, 22 Dec 2021 20:00:04 +0100
parents 29ec2c198c8d
children b96ceb97e896
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 " Vim indent file
20753
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18343
diff changeset
2 " Language: YAML
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18343
diff changeset
3 " Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18343
diff changeset
4 " Last Update: Lukas Reineke
25619
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
5 " Last Change: 2021 Aug 13
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
7 " Only load this indent file when no other was loaded.
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8 if exists('b:did_indent')
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 finish
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10 endif
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 let b:did_indent = 1
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 setlocal indentexpr=GetYAMLIndent(v:lnum)
7228
873eae260c97 commit https://github.com/vim/vim/commit/b4ff518d95aa57c2f8c0568c915035bef849581b
Christian Brabandt <cb@256bit.org>
parents: 7147
diff changeset
15 setlocal indentkeys=!^F,o,O,0#,0},0],<:>,0-
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 setlocal nosmartindent
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
18 let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 " Only define the function once.
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 if exists('*GetYAMLIndent')
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 finish
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23 endif
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24
23737
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 20753
diff changeset
25 let s:save_cpo = &cpo
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 20753
diff changeset
26 set cpo&vim
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 20753
diff changeset
27
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
28 function s:FindPrevLessIndentedLine(lnum, ...)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
29 let prevlnum = prevnonblank(a:lnum-1)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 let curindent = a:0 ? a:1 : indent(a:lnum)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31 while prevlnum
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 \&& indent(prevlnum) >= curindent
18343
375a7ecdb351 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
33 \&& getline(prevlnum) !~# '^\s*#'
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
34 let prevlnum = prevnonblank(prevlnum-1)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 endwhile
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36 return prevlnum
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 endfunction
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
38
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
39 function s:FindPrevLEIndentedLineMatchingRegex(lnum, regex)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
40 let plilnum = s:FindPrevLessIndentedLine(a:lnum, indent(a:lnum)+1)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41 while plilnum && getline(plilnum) !~# a:regex
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
42 let plilnum = s:FindPrevLessIndentedLine(plilnum)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
43 endwhile
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
44 return plilnum
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
45 endfunction
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
46
9887
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
47 let s:mapkeyregex='\v^\s*\#@!\S@=%(\''%([^'']|\''\'')*\'''.
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
48 \ '|\"%([^"\\]|\\.)*\"'.
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
49 \ '|%(%(\:\ )@!.)*)\:%(\ |$)'
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
50 let s:liststartregex='\v^\s*%(\-%(\ |$))'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
51
9887
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
52 let s:c_ns_anchor_char = '\v%([\n\r\uFEFF \t,[\]{}]@!\p)'
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
53 let s:c_ns_anchor_name = s:c_ns_anchor_char.'+'
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
54 let s:c_ns_anchor_property = '\v\&'.s:c_ns_anchor_name
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
55
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
56 let s:ns_word_char = '\v[[:alnum:]_\-]'
20753
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18343
diff changeset
57 let s:ns_tag_char = '\v%('.s:ns_word_char.'|[#/;?:@&=+$.~*''()])'
9887
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
58 let s:c_named_tag_handle = '\v\!'.s:ns_word_char.'+\!'
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
59 let s:c_secondary_tag_handle = '\v\!\!'
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
60 let s:c_primary_tag_handle = '\v\!'
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
61 let s:c_tag_handle = '\v%('.s:c_named_tag_handle.
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
62 \ '|'.s:c_secondary_tag_handle.
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
63 \ '|'.s:c_primary_tag_handle.')'
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
64 let s:c_ns_shorthand_tag = '\v'.s:c_tag_handle . s:ns_tag_char.'+'
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
65 let s:c_non_specific_tag = '\v\!'
20753
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18343
diff changeset
66 let s:ns_uri_char = '\v%('.s:ns_word_char.'\v|[#/;?:@&=+$,.!~*''()[\]])'
9887
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
67 let s:c_verbatim_tag = '\v\!\<'.s:ns_uri_char.'+\>'
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
68 let s:c_ns_tag_property = '\v'.s:c_verbatim_tag.
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
69 \ '\v|'.s:c_ns_shorthand_tag.
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
70 \ '\v|'.s:c_non_specific_tag
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
71
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
72 let s:block_scalar_header = '\v[|>]%([+-]?[1-9]|[1-9]?[+-])?'
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
73
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
74 function GetYAMLIndent(lnum)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
75 if a:lnum == 1 || !prevnonblank(a:lnum-1)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
76 return 0
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
77 endif
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
78
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
79 let prevlnum = prevnonblank(a:lnum-1)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
80 let previndent = indent(prevlnum)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
81
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
82 let line = getline(a:lnum)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
83 if line =~# '^\s*#' && getline(a:lnum-1) =~# '^\s*#'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
84 " Comment blocks should have identical indent
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
85 return previndent
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
86 elseif line =~# '^\s*[\]}]'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
87 " Lines containing only closing braces should have previous indent
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
88 return indent(s:FindPrevLessIndentedLine(a:lnum))
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
89 endif
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
90
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
91 " Ignore comment lines when calculating indent
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
92 while getline(prevlnum) =~# '^\s*#'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
93 let prevlnum = prevnonblank(prevlnum-1)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
94 if !prevlnum
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
95 return previndent
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
96 endif
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
97 endwhile
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
98
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
99 let prevline = getline(prevlnum)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
100 let previndent = indent(prevlnum)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
101
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
102 " Any examples below assume that shiftwidth=2
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
103 if prevline =~# '\v[{[:]$|[:-]\ [|>][+\-]?%(\s+\#.*|\s*)$'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
104 " Mapping key:
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
105 " nested mapping: ...
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
106 "
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
107 " - {
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
108 " key: [
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
109 " list value
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
110 " ]
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
111 " }
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
112 "
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
113 " - |-
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
114 " Block scalar without indentation indicator
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9887
diff changeset
115 return previndent+shiftwidth()
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
116 elseif prevline =~# '\v[:-]\ [|>]%(\d+[+\-]?|[+\-]?\d+)%(\#.*|\s*)$'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
117 " - |+2
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
118 " block scalar with indentation indicator
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
119 "#^^ indent+2, not indent+shiftwidth
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
120 return previndent + str2nr(matchstr(prevline,
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
121 \'\v([:-]\ [|>])@<=[+\-]?\d+%([+\-]?%(\s+\#.*|\s*)$)@='))
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
122 elseif prevline =~# '\v\"%([^"\\]|\\.)*\\$'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
123 " "Multiline string \
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
124 " with escaped end"
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
125 let qidx = match(prevline, '\v\"%([^"\\]|\\.)*\\')
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
126 return virtcol([prevlnum, qidx+1])
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
127 elseif line =~# s:liststartregex
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
128 " List line should have indent equal to previous list line unless it was
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
129 " caught by one of the previous rules
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
130 return indent(s:FindPrevLEIndentedLineMatchingRegex(a:lnum,
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
131 \ s:liststartregex))
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
132 elseif line =~# s:mapkeyregex
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
133 " Same for line containing mapping key
7147
c590de398af9 commit https://github.com/vim/vim/commit/ca63501fbcd1cf9c8aa9ff12c093c95b62a89ed7
Christian Brabandt <cb@256bit.org>
parents: 3996
diff changeset
134 let prevmapline = s:FindPrevLEIndentedLineMatchingRegex(a:lnum,
c590de398af9 commit https://github.com/vim/vim/commit/ca63501fbcd1cf9c8aa9ff12c093c95b62a89ed7
Christian Brabandt <cb@256bit.org>
parents: 3996
diff changeset
135 \ s:mapkeyregex)
c590de398af9 commit https://github.com/vim/vim/commit/ca63501fbcd1cf9c8aa9ff12c093c95b62a89ed7
Christian Brabandt <cb@256bit.org>
parents: 3996
diff changeset
136 if getline(prevmapline) =~# '^\s*- '
c590de398af9 commit https://github.com/vim/vim/commit/ca63501fbcd1cf9c8aa9ff12c093c95b62a89ed7
Christian Brabandt <cb@256bit.org>
parents: 3996
diff changeset
137 return indent(prevmapline) + 2
c590de398af9 commit https://github.com/vim/vim/commit/ca63501fbcd1cf9c8aa9ff12c093c95b62a89ed7
Christian Brabandt <cb@256bit.org>
parents: 3996
diff changeset
138 else
c590de398af9 commit https://github.com/vim/vim/commit/ca63501fbcd1cf9c8aa9ff12c093c95b62a89ed7
Christian Brabandt <cb@256bit.org>
parents: 3996
diff changeset
139 return indent(prevmapline)
c590de398af9 commit https://github.com/vim/vim/commit/ca63501fbcd1cf9c8aa9ff12c093c95b62a89ed7
Christian Brabandt <cb@256bit.org>
parents: 3996
diff changeset
140 endif
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
141 elseif prevline =~# '^\s*- '
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
142 " - List with
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
143 " multiline scalar
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
144 return previndent+2
9887
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
145 elseif prevline =~# s:mapkeyregex . '\v\s*%(%('.s:c_ns_tag_property.
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
146 \ '\v|'.s:c_ns_anchor_property.
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
147 \ '\v|'.s:block_scalar_header.
b4da19b7539f commit https://github.com/vim/vim/commit/dc1f1645cb495fa6bfbe216d7359f23539a0e25d
Christian Brabandt <cb@256bit.org>
parents: 7228
diff changeset
148 \ '\v)%(\s+|\s*%(\#.*)?$))*'
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
149 " Mapping with: value
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
150 " that is multiline scalar
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9887
diff changeset
151 return previndent+shiftwidth()
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
152 endif
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
153 return previndent
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
154 endfunction
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
155
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
156 let &cpo = s:save_cpo