aboutsummaryrefslogtreecommitdiff
path: root/runtime/indent/sh.vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/indent/sh.vim')
-rw-r--r--runtime/indent/sh.vim6
1 files changed, 5 insertions, 1 deletions
diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim
index aa47c6d1bd..184e829873 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:
+" 20241411 - Detect dash character in function keyword for
+" bash mode (issue #16049)
" 20190726 - Correctly skip if keywords in syntax comments
" (issue #17)
" 20190603 - Do not indent in zsh filetypes with an `if` in comments
@@ -195,7 +197,9 @@ endfunction
function! s:is_function_definition(line)
return a:line =~ '^\s*\<\k\+\>\s*()\s*{' ||
\ a:line =~ '^\s*{' ||
- \ a:line =~ '^\s*function\s*\k\+\s*\%(()\)\?\s*{'
+ \ a:line =~ '^\s*function\s*\k\+\s*\%(()\)\?\s*{' ||
+ \ ((&ft is# 'zsh' || s:is_bash()) &&
+ \ a:line =~ '^\s*function\s*\S\+\s*\%(()\)\?\s*{' )
endfunction
function! s:is_array(line)