comparison runtime/indent/sh.vim @ 18456:6d11fc4aa683

Update runtime files Commit: https://github.com/vim/vim/commit/96f45c0b6fc9e9d404e6805593ed1e0e6795e470 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 26 19:53:45 2019 +0200 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Sat, 26 Oct 2019 20:00:04 +0200
parents 2704c4e3e20a
children f0d7cb510ce3
comparison
equal deleted inserted replaced
18455:3c98dfd2380c 18456:6d11fc4aa683
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-07-26 6 " Latest Revision: 2019-10-24
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 " 20190726 - Correctly skip if keywords in syntax comments 10 " 20190726 - Correctly skip if keywords in syntax comments
11 " (issue #17) 11 " (issue #17)
132 let line = curline 132 let line = curline
133 " Current line is a endif line, so get indent from start of "if condition" line 133 " Current line is a endif line, so get indent from start of "if condition" line
134 " TODO: should we do the same for other "end" lines? 134 " TODO: should we do the same for other "end" lines?
135 if curline =~ '^\s*\%(fi\);\?\s*\%(#.*\)\=$' 135 if curline =~ '^\s*\%(fi\);\?\s*\%(#.*\)\=$'
136 let ind = indent(v:lnum) 136 let ind = indent(v:lnum)
137 let previous_line = searchpair('\<if\>', '', '\<fi\>\zs', 'bnW', 'synIDattr(synID(line("."),col("."), 1),"name") =~? "comment"') 137 let previous_line = searchpair('\<if\>', '', '\<fi\>\zs', 'bnW', 'synIDattr(synID(line("."),col("."), 1),"name") =~? "comment\\|quote"')
138 if previous_line > 0 138 if previous_line > 0
139 let ind = indent(previous_line) 139 let ind = indent(previous_line)
140 endif 140 endif
141 elseif line =~ '^\s*\%(then\|do\|else\|elif\|done\|end\)\>' || s:end_block(line) 141 elseif line =~ '^\s*\%(then\|do\|else\|elif\|done\|end\)\>' || s:end_block(line)
142 let ind -= s:indent_value('default') 142 let ind -= s:indent_value('default')
193 endfunction 193 endfunction
194 194
195 function! s:is_function_definition(line) 195 function! s:is_function_definition(line)
196 return a:line =~ '^\s*\<\k\+\>\s*()\s*{' || 196 return a:line =~ '^\s*\<\k\+\>\s*()\s*{' ||
197 \ a:line =~ '^\s*{' || 197 \ a:line =~ '^\s*{' ||
198 \ a:line =~ '^\s*function\s*\w\S\+\s*\%(()\)\?\s*{' 198 \ a:line =~ '^\s*function\s*\k\+\s*\%(()\)\?\s*{'
199 endfunction 199 endfunction
200 200
201 function! s:is_array(line) 201 function! s:is_array(line)
202 return a:line =~ '^\s*\<\k\+\>=(' 202 return a:line =~ '^\s*\<\k\+\>=('
203 endfunction 203 endfunction