diff options
Diffstat (limited to 'runtime/indent/sh.vim')
-rw-r--r-- | runtime/indent/sh.vim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim index c93be31958..0396b4eb94 100644 --- a/runtime/indent/sh.vim +++ b/runtime/indent/sh.vim @@ -7,6 +7,8 @@ " License: Vim (see :h license) " Repository: https://github.com/chrisbra/vim-sh-indent " Changelog: +" 20190316 - Make use of searchpairpos for nested if sections +" fixes #11 " 20190201 - Better check for closing if sections " 20180724 - make check for zsh syntax more rigid (needs word-boundaries) " 20180326 - better support for line continuation @@ -115,7 +117,7 @@ function! GetShIndent() " Current line is a endif line, so get indent from start of "if condition" line " TODO: should we do the same for other "end" lines? if curline =~ '^\s*\%(fi\)\s*\%(#.*\)\=$' - let previous_line = search('if.\{-\};\s*then\s*\%(#.*\)\=$', 'bnW') + let previous_line = searchpair('\<if\>', '', '\<fi\>', 'bnW') if previous_line > 0 let ind = indent(previous_line) endif |