neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 1b83b00fff40e13ecea06246ca33c2f41256a968
parent d77a32d805871ad8e08af809f76ec74c1df4a64c
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Fri,  9 Jan 2026 09:37:28 +0800

vim-patch:8e07908: runtime(sh): Update indent script

closes: vim/vim#19110

https://github.com/vim/vim/commit/8e079085d23c9ca5eb352519a1142f91d247ab55

Co-authored-by: Christian Brabandt <cb@256bit.org>

Diffstat:
Mruntime/indent/sh.vim | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git 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