runtime(sh): Update indent script
Commit:
https://github.com/vim/vim/commit/8e079085d23c9ca5eb352519a1142f91d247ab55
Author: Christian Brabandt <[email protected]>
Date: Thu Jan 8 20:52:01 2026 +0000
runtime(sh): Update indent script
closes: https://github.com/vim/vim/issues/19110
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim
index a1abd1d0a..daf9170bf 100644
--- a/runtime/indent/sh.vim
+++ b/runtime/indent/sh.vim
@@ -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
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1vdx6x-003DdY-7m%40256bit.org.