comparison runtime/indent/sh.vim @ 16610:1eaf34420bb3

Update runtime files commit https://github.com/vim/vim/commit/a6c27c47ddf081859659d7de1caec675147e466b Author: Bram Moolenaar <Bram@vim.org> Date: Thu May 9 19:16:22 2019 +0200 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Thu, 09 May 2019 19:30:06 +0200
parents b471858040bc
children 2704c4e3e20a
comparison
equal deleted inserted replaced
16609:175385d2d3d9 16610:1eaf34420bb3
1 " Vim indent file 1 " Vim indent file
2 " Language: Shell Script 2 " Language: Shell Script
3 " Maintainer: Christian Brabandt <cb@256bit.org> 3 " Maintainer: Christian Brabandt <cb@256bit.org>
4 " Original Author: Nikolai Weibull <now@bitwi.se> 4 " Original Author: Nikolai Weibull <now@bitwi.se>
5 " Previous Maintainer: Peter Aronoff <telemachus@arpinum.org> 5 " Previous Maintainer: Peter Aronoff <telemachus@arpinum.org>
6 " Latest Revision: 2019-03-25 6 " Latest Revision: 2019-04-27
7 " License: Vim (see :h license) 7 " License: Vim (see :h license)
8 " Repository: https://github.com/chrisbra/vim-sh-indent 8 " Repository: https://github.com/chrisbra/vim-sh-indent
9 " Changelog: 9 " Changelog:
10 " 20190428 - De-indent fi correctly when typing with
11 " https://github.com/chrisbra/vim-sh-indent/issues/15
10 " 20190325 - Indent fi; correctly 12 " 20190325 - Indent fi; correctly
11 " https://github.com/chrisbra/vim-sh-indent/issues/14 13 " https://github.com/chrisbra/vim-sh-indent/issues/14
12 " 20190319 - Indent arrays (only zsh and bash) 14 " 20190319 - Indent arrays (only zsh and bash)
13 " https://github.com/chrisbra/vim-sh-indent/issues/13 15 " https://github.com/chrisbra/vim-sh-indent/issues/13
14 " 20190316 - Make use of searchpairpos for nested if sections 16 " 20190316 - Make use of searchpairpos for nested if sections
125 " Check content of current line 127 " Check content of current line
126 let line = curline 128 let line = curline
127 " Current line is a endif line, so get indent from start of "if condition" line 129 " Current line is a endif line, so get indent from start of "if condition" line
128 " TODO: should we do the same for other "end" lines? 130 " TODO: should we do the same for other "end" lines?
129 if curline =~ '^\s*\%(fi\);\?\s*\%(#.*\)\=$' 131 if curline =~ '^\s*\%(fi\);\?\s*\%(#.*\)\=$'
130 let previous_line = searchpair('\<if\>', '', '\<fi\>', 'bnW') 132 let previous_line = searchpair('\<if\>', '', '\<fi\>\zs', 'bnW')
131 if previous_line > 0 133 if previous_line > 0
132 let ind = indent(previous_line) 134 let ind = indent(previous_line)
133 endif 135 endif
134 elseif line =~ '^\s*\%(then\|do\|else\|elif\|done\|end\)\>' || s:end_block(line) 136 elseif line =~ '^\s*\%(then\|do\|else\|elif\|done\|end\)\>' || s:end_block(line)
135 let ind -= s:indent_value('default') 137 let ind -= s:indent_value('default')