Mercurial > vim
comparison runtime/indent/yaml.vim @ 11518:63b0b7b79b25
Update runtime files.
commit https://github.com/vim/vim/commit/3ec574f2b549f456f664f689d6da36dc5719aeb9
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jun 13 18:12:01 2017 +0200
Update runtime files.
Includes changing &sw to shiftwidth() for all indent scripts.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 13 Jun 2017 18:15:04 +0200 |
parents | b4da19b7539f |
children | 375a7ecdb351 |
comparison
equal
deleted
inserted
replaced
11517:01330ca5f7f8 | 11518:63b0b7b79b25 |
---|---|
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 Change: 2015 Nov 01 | 4 " Last Change: 2017 Jun 13 |
5 | 5 |
6 " Only load this indent file when no other was loaded. | 6 " Only load this indent file when no other was loaded. |
7 if exists('b:did_indent') | 7 if exists('b:did_indent') |
8 finish | 8 finish |
9 endif | 9 endif |
20 let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<' | 20 let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<' |
21 | 21 |
22 " Only define the function once. | 22 " Only define the function once. |
23 if exists('*GetYAMLIndent') | 23 if exists('*GetYAMLIndent') |
24 finish | 24 finish |
25 endif | |
26 | |
27 if exists('*shiftwidth') | |
28 let s:shiftwidth = function('shiftwidth') | |
29 else | |
30 function s:shiftwidth() | |
31 return &shiftwidth | |
32 endfunction | |
33 endif | 25 endif |
34 | 26 |
35 function s:FindPrevLessIndentedLine(lnum, ...) | 27 function s:FindPrevLessIndentedLine(lnum, ...) |
36 let prevlnum = prevnonblank(a:lnum-1) | 28 let prevlnum = prevnonblank(a:lnum-1) |
37 let curindent = a:0 ? a:1 : indent(a:lnum) | 29 let curindent = a:0 ? a:1 : indent(a:lnum) |
117 " ] | 109 " ] |
118 " } | 110 " } |
119 " | 111 " |
120 " - |- | 112 " - |- |
121 " Block scalar without indentation indicator | 113 " Block scalar without indentation indicator |
122 return previndent+s:shiftwidth() | 114 return previndent+shiftwidth() |
123 elseif prevline =~# '\v[:-]\ [|>]%(\d+[+\-]?|[+\-]?\d+)%(\#.*|\s*)$' | 115 elseif prevline =~# '\v[:-]\ [|>]%(\d+[+\-]?|[+\-]?\d+)%(\#.*|\s*)$' |
124 " - |+2 | 116 " - |+2 |
125 " block scalar with indentation indicator | 117 " block scalar with indentation indicator |
126 "#^^ indent+2, not indent+shiftwidth | 118 "#^^ indent+2, not indent+shiftwidth |
127 return previndent + str2nr(matchstr(prevline, | 119 return previndent + str2nr(matchstr(prevline, |
153 \ '\v|'.s:c_ns_anchor_property. | 145 \ '\v|'.s:c_ns_anchor_property. |
154 \ '\v|'.s:block_scalar_header. | 146 \ '\v|'.s:block_scalar_header. |
155 \ '\v)%(\s+|\s*%(\#.*)?$))*' | 147 \ '\v)%(\s+|\s*%(\#.*)?$))*' |
156 " Mapping with: value | 148 " Mapping with: value |
157 " that is multiline scalar | 149 " that is multiline scalar |
158 return previndent+s:shiftwidth() | 150 return previndent+shiftwidth() |
159 endif | 151 endif |
160 return previndent | 152 return previndent |
161 endfunction | 153 endfunction |
162 | 154 |
163 let &cpo = s:save_cpo | 155 let &cpo = s:save_cpo |