Mercurial > vim
comparison runtime/indent/yaml.vim @ 7147:c590de398af9
commit https://github.com/vim/vim/commit/ca63501fbcd1cf9c8aa9ff12c093c95b62a89ed7
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 25 20:34:21 2015 +0200
Update various runtime files.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 25 Sep 2015 20:45:09 +0200 |
parents | b3f3237a3d72 |
children | 873eae260c97 |
comparison
equal
deleted
inserted
replaced
7146:274adc0c2140 | 7147:c590de398af9 |
---|---|
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 Sep 25 | |
4 | 5 |
5 " Only load this indent file when no other was loaded. | 6 " Only load this indent file when no other was loaded. |
6 if exists('b:did_indent') | 7 if exists('b:did_indent') |
7 finish | 8 finish |
8 endif | 9 endif |
113 " caught by one of the previous rules | 114 " caught by one of the previous rules |
114 return indent(s:FindPrevLEIndentedLineMatchingRegex(a:lnum, | 115 return indent(s:FindPrevLEIndentedLineMatchingRegex(a:lnum, |
115 \ s:liststartregex)) | 116 \ s:liststartregex)) |
116 elseif line =~# s:mapkeyregex | 117 elseif line =~# s:mapkeyregex |
117 " Same for line containing mapping key | 118 " Same for line containing mapping key |
118 return indent(s:FindPrevLEIndentedLineMatchingRegex(a:lnum, | 119 let prevmapline = s:FindPrevLEIndentedLineMatchingRegex(a:lnum, |
119 \ s:mapkeyregex)) | 120 \ s:mapkeyregex) |
121 if getline(prevmapline) =~# '^\s*- ' | |
122 return indent(prevmapline) + 2 | |
123 else | |
124 return indent(prevmapline) | |
125 endif | |
120 elseif prevline =~# '^\s*- ' | 126 elseif prevline =~# '^\s*- ' |
121 " - List with | 127 " - List with |
122 " multiline scalar | 128 " multiline scalar |
123 return previndent+2 | 129 return previndent+2 |
124 elseif prevline =~# s:mapkeyregex | 130 elseif prevline =~# s:mapkeyregex |