mirror of
https://github.com/neovim/neovim.git
synced 2026-07-22 09:01:45 +00:00
vim-patch:8e07908: runtime(sh): Update indent script
closes: vim/vim#19110
8e079085d2
Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
" License: Vim (see :h license)
|
||||
" Repository: https://github.com/chrisbra/vim-sh-indent
|
||||
" Changelog:
|
||||
" 20250906 - indent function closing properly on multiline commands
|
||||
" 20250318 - Detect local arrays in functions
|
||||
" 20241411 - Detect dash character in function keyword for
|
||||
" bash mode (issue #16049)
|
||||
@@ -186,6 +187,15 @@ function! GetShIndent()
|
||||
endif
|
||||
endif
|
||||
|
||||
" Special case: if the current line is a closing '}', align with matching '{'
|
||||
if curline =~ '^\s*}\s*$'
|
||||
let match_lnum = searchpair('{', '', '}', 'bnW',
|
||||
\ 'synIDattr(synID(line("."),col("."), 1),"name") =~? "comment\\|quote"')
|
||||
if match_lnum > 0
|
||||
return indent(match_lnum)
|
||||
endif
|
||||
endif
|
||||
|
||||
return ind > 0 ? ind : 0
|
||||
endfunction
|
||||
|
||||
|
||||
Reference in New Issue
Block a user