summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkearns <dougkearns@gmail.com>2024-04-15 04:32:56 +1000
committerGitHub <noreply@github.com>2024-04-14 20:32:56 +0200
commit4ba70cab37d2a625d8c59bb136070ef9d1976934 (patch)
treeb08db573f2267ff4c35d64afc2aab959473c5856
parentc59a8648b2d8b3e17f12cd45f74a31b1aa385d2d (diff)
runtime(vim): Update base-syntax, fix nested function folding (#14397)
Only match function folding start and end patterns at the start of a line, excluding heredocs and :append/:change/:insert commands. Fixes #14393 Signed-off-by: Christian Brabandt <cb@256bit.org> Signed-off-by: Doug Kearns <dougkearns@gmail.com>
-rw-r--r--runtime/syntax/generator/vim.vim.base24
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_def_fold_01.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_def_fold_02.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_def_fold_03.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_def_fold_04.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_def_fold_05.dump6
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_def_fold_06.dump26
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_def_fold_07.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_def_fold_99.dump24
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_def_nested_00.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_def_nested_99.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_def_nested_fold_00.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_def_nested_fold_01.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_def_nested_fold_99.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_fold_01.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_fold_02.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_fold_03.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_fold_04.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_fold_05.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_fold_06.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_fold_07.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_fold_08.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_fold_09.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_fold_10.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_fold_11.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_fold_12.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_fold_99.dump30
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_nested_00.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_nested_01.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_nested_99.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_nested_fold_00.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_nested_fold_01.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_nested_fold_02.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_nested_fold_99.dump20
-rw-r--r--runtime/syntax/testdir/input/vim_ex_def_fold.vim20
-rw-r--r--runtime/syntax/testdir/input/vim_ex_def_nested.vim20
-rw-r--r--runtime/syntax/testdir/input/vim_ex_def_nested_fold.vim22
-rw-r--r--runtime/syntax/testdir/input/vim_ex_function_fold.vim40
-rw-r--r--runtime/syntax/testdir/input/vim_ex_function_nested.vim38
-rw-r--r--runtime/syntax/testdir/input/vim_ex_function_nested_fold.vim40
-rw-r--r--runtime/syntax/vim.vim22
41 files changed, 581 insertions, 77 deletions
diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base
index f5e2110a29..90e1ee59bb 100644
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -3,7 +3,7 @@
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougkearns@gmail.com>
" URL: https://github.com/vim-jp/syntax-vim-ex
-" Last Change: 2024 Apr 12
+" Last Change: 2024 Apr 13
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -191,9 +191,9 @@ syn cluster vimExprList contains=vimEnvvar,vimFunc,vimFuncVar,vimNumber,vimOper,
" (buftype != nofile test avoids having append, change, insert show up in the command window)
" =======================
if &buftype != 'nofile'
- syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=a\%[ppend]$" matchgroup=vimCommand end="^\.$""
- syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=c\%[hange]$" matchgroup=vimCommand end="^\.$""
- syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=i\%[nsert]$" matchgroup=vimCommand end="^\.$""
+ syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=a\%[ppend]$" matchgroup=vimCommand end="^\.$" extend
+ syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=c\%[hange]$" matchgroup=vimCommand end="^\.$" extend
+ syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=i\%[nsert]$" matchgroup=vimCommand end="^\.$" extend
endif
" Behave! {{{2
@@ -244,12 +244,14 @@ if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noopererror")
syn match vimOperError ")"
endif
-" Functions : Tag is provided for those who wish to highlight tagged functions {{{2
+" Functions: Tag is provided for those who wish to highlight tagged functions {{{2
" =========
syn cluster vimFuncList contains=vimFuncBang,vimFunctionError,vimFuncKey,vimFuncSID,Tag
syn cluster vimDefList contains=vimFuncBang,vimFunctionError,vimDefKey,vimFuncSID,Tag
-syn cluster vimFuncBodyList contains=@vimCmdList,vimCmplxRepeat,vimComment,vimContinue,vimCtrlChar,vimDef,vimEnvvar,vimFBVar,vimFunc,vimFunction,vimFuncVar,vimLetHereDoc,vimLineComment,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegion,vimRegister,vimSearch,vimSpecFile,vimString,vimSubst
-syn cluster vimDefBodyList contains=@vimCmdList,vimCmplxRepeat,vim9Comment,vimContinue,vimCtrlChar,vimDef,vimEnvvar,vimFBVar,vimFunc,vimFunction,vimLetHereDoc,vim9LineComment,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegion,vimRegister,vimSearch,vimSpecFile,vimString,vimSubst
+
+syn cluster vimFuncBodyCommon contains=@vimCmdList,vimCmplxRepeat,vimContinue,vimCtrlChar,vimDef,vimEnvvar,vimFBVar,vimFunc,vimFunction,vimLetHereDoc,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegister,vimSearch,vimSpecFile,vimString,vimSubst,vimFuncFold
+syn cluster vimFuncBodyList contains=@vimFuncBodyCommon,vimComment,vimLineComment,vimFuncVar,vimInsert
+syn cluster vimDefBodyList contains=@vimFuncBodyCommon,vim9Comment,vim9LineComment
syn region vimFuncPattern contained matchgroup=vimOper start="/" end="$" contains=@vimSubstList
syn match vimFunction "\<fu\%[nction]\>" skipwhite nextgroup=vimCmdSep,vimComment,vimFuncPattern contains=vimFuncKey
@@ -284,9 +286,9 @@ syn match vimEndfunction "\<endf\%[unction]\>"
syn match vimEnddef "\<enddef\>"
if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f'
- syn region vimFuncFold start="\<fu\%[nction]\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)\+\s*(" end="\<endf\%[unction]\>" contains=vimFunction fold keepend transparent
- syn region vimFuncFold start="\<def\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\)\+(" end="\<enddef\>" contains=vimDef fold keepend transparent
- syn region vimFuncFold start="\<def\s\+new\i\+(" end="\<enddef\>" contains=vimDef fold keepend transparent
+ syn region vimFuncFold start="^\s*:\=\s*fu\%[nction]\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)\+\s*(" end="^\s*:\=\s*endf\%[unction]\>" contains=vimFunction fold keepend extend transparent
+ syn region vimFuncFold start="^\s*:\=\s*def\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\)\+(" end="^\s*:\=\s*enddef\>" contains=vimDef fold keepend extend transparent
+ syn region vimFuncFold start="^\s*:\=\s*def\s\+new\i\+(" end="^\s*:\=\s*enddef\>" contains=vimDef fold keepend extend transparent
endif
syn match vimFuncVar contained "a:\%(\K\k*\|\d\+\)\>"
@@ -502,7 +504,7 @@ syn keyword vimUnlet unl[et] skipwhite nextgroup=vimUnletBang,vimUnletVars
syn match vimUnletBang contained "!" skipwhite nextgroup=vimUnletVars
syn region vimUnletVars contained start="$\I\|\h" skip="\n\s*\\" end="$" end="|" contains=vimVar,vimEnvvar,vimContinue,vimString,vimNumber
-VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\%(eval\s\+\)\=\|eval\s\+\%(trim\s\+\)\=\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1\s*$'
+VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\%(eval\s\+\)\=\|eval\s\+\%(trim\s\+\)\=\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1\s*$' extend
syn keyword vimLet var skipwhite nextgroup=vimVar,vimFuncVar,vimLetHereDoc
" For: {{{2
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_fold_01.dump b/runtime/syntax/testdir/dumps/vim_ex_def_fold_01.dump
index 4f80331b5c..fa5ed9f5a4 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_def_fold_01.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_fold_01.dump
@@ -17,4 +17,4 @@
| +0#0000000#ffffff0@74
|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |d|e|f|!| |F|o@1|(|)|:| |n|u|m|b|e|r|-@42
| +0#0000000#ffffff0@74
-@57|1|9|,|1| @9|1|6|%|
+@57|1|9|,|1| @9|1|2|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_fold_02.dump b/runtime/syntax/testdir/dumps/vim_ex_def_fold_02.dump
index bbd362c83d..2cfdcd4eae 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_def_fold_02.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_fold_02.dump
@@ -17,4 +17,4 @@
| +0#0000000#ffffff0@74
|"+0#0000e05&| |s|a|m|e| |n|a|m|e| |a|s| |a|n| |E|x| |c|o|m@1|a|n|d| +0#0000000&@46
|++0#0000e05#a8a8a8255|-@1| @1|2| |l|i|n|e|s|:| |d|e|f| |s|:|l|s|(|)|-@50
-| +0#0000000#ffffff0@56|3|7|,|1| @9|3|4|%|
+| +0#0000000#ffffff0@56|3|7|,|1| @9|2|7|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_fold_03.dump b/runtime/syntax/testdir/dumps/vim_ex_def_fold_03.dump
index 7ba9744e8e..6673415128 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_def_fold_03.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_fold_03.dump
@@ -17,4 +17,4 @@
| +0#0000000#ffffff0@74
|++0#0000e05#a8a8a8255|-@1| @1|2| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|:| |l|i|s|t|<|d|i|c|t|<|n|u|m|b|e|r|>@1|-@31
| +0#0000000#ffffff0@74
-@57|5@1|,|1| @9|5@1|%|
+@57|5@1|,|1| @9|4@1|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_fold_04.dump b/runtime/syntax/testdir/dumps/vim_ex_def_fold_04.dump
index 66c845b2ba..d2f047b06c 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_def_fold_04.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_fold_04.dump
@@ -17,4 +17,4 @@
|++0#0000e05#a8a8a8255|-@1| @1|2| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
| +0#0000000#ffffff0@74
@75
-@57|7|3|,|1| @9|7@1|%|
+@57|7|3|,|1| @9|6|2|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_fold_05.dump b/runtime/syntax/testdir/dumps/vim_ex_def_fold_05.dump
index 688b788eb8..e2decdb0a3 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_def_fold_05.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_fold_05.dump
@@ -15,6 +15,6 @@
@75
|++0#0000e05#a8a8a8255|-@1| @1|4| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
| +0#0000000#ffffff0@74
-|~+0#4040ff13&| @73
-|~| @73
-| +0#0000000&@56|9|1|,|0|-|1| @7|B|o|t|
+@75
+|"+0#0000e05&| |f|o|l|d|-|r|e|g|i|o|n| |e|n|d|i|n|g| +0#0000000&@54
+@57|9|1|,|0|-|1| @7|8|2|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_fold_06.dump b/runtime/syntax/testdir/dumps/vim_ex_def_fold_06.dump
index c93c671669..2997eb863a 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_def_fold_06.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_fold_06.dump
@@ -1,20 +1,20 @@
-| +0&#ffffff0@74
-|++0#0000e05#a8a8a8255|-@1| @1|2| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
-| +0#0000000#ffffff0@74
-@75
-|"+0#0000e05&| |p|a|r|a|m|e|t|e|r|s| +0#0000000&@62
-> @74
-|++0#0000e05#a8a8a8255|-@1| @1|2| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|x|:| |b|o@1|l|,| |y| |=| |4|2|,| |z|:| |s|t|r|i|n|g| |=| |"|z|e|d|"|)|-@17
-| +0#0000000#ffffff0@74
|++0#0000e05#a8a8a8255|-@1| @1|5| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|-@52
| +0#0000000#ffffff0@74
@75
|"+0#0000e05&| |c|o|m@1|e|n|t|s| +0#0000000&@64
@75
-|++0#0000e05#a8a8a8255|-@1| @1|4| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
+>++0#0000e05#a8a8a8255|-@1| @1|4| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
+| +0#0000000#ffffff0@74
+@75
+|"+0#0000e05&| |f|o|l|d|-|r|e|g|i|o|n| |e|n|d|i|n|g| +0#0000000&@54
+@75
+|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
+| +0#0000000#ffffff0@74
+|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
+| +0#0000000#ffffff0@74
+|++0#0000e05#a8a8a8255|-@1| @1|5| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
+| +0#0000000#ffffff0@74
+|++0#0000e05#a8a8a8255|-@1| @1|2| |l|i|n|e|s|:| |:|d|e|f| |F|o@1|(|)|-@50
| +0#0000000#ffffff0@74
|~+0#4040ff13&| @73
-|~| @73
-|~| @73
-|~| @73
-| +0#0000000&@56|1|0|9|,|0|-|1| @6|B|o|t|
+| +0#0000000&@56|1|0|9|,|1| @8|B|o|t|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_fold_07.dump b/runtime/syntax/testdir/dumps/vim_ex_def_fold_07.dump
new file mode 100644
index 0000000000..b11b61e1c6
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_fold_07.dump
@@ -0,0 +1,20 @@
+|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
+| +0#0000000#ffffff0@74
+|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
+| +0#0000000#ffffff0@74
+|++0#0000e05#a8a8a8255|-@1| @1|5| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
+> +0#0000000#ffffff0@74
+|++0#0000e05#a8a8a8255|-@1| @1|2| |l|i|n|e|s|:| |:|d|e|f| |F|o@1|(|)|-@50
+| +0#0000000#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|2|7|,|0|-|1| @6|B|o|t|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_fold_99.dump b/runtime/syntax/testdir/dumps/vim_ex_def_fold_99.dump
index f9e9ae099e..3020a24ad1 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_def_fold_99.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_fold_99.dump
@@ -1,20 +1,20 @@
| +0&#ffffff0@74
-|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
-| +0#0000000#ffffff0@74
-|++0#0000e05#a8a8a8255|-@1| @1|2| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
-| +0#0000000#ffffff0@74
-|++0#0000e05#a8a8a8255|-@1| @1|2| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
-| +0#0000000#ffffff0@74
-@75
-|"+0#0000e05&| |p|a|r|a|m|e|t|e|r|s| +0#0000000&@62
-@75
-|++0#0000e05#a8a8a8255|-@1| @1|2| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|x|:| |b|o@1|l|,| |y| |=| |4|2|,| |z|:| |s|t|r|i|n|g| |=| |"|z|e|d|"|)|-@17
-| +0#0000000#ffffff0@74
|++0#0000e05#a8a8a8255|-@1| @1|5| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|-@52
| +0#0000000#ffffff0@74
@75
|"+0#0000e05&| |c|o|m@1|e|n|t|s| +0#0000000&@64
@75
|++0#0000e05#a8a8a8255|-@1| @1|4| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
+| +0#0000000#ffffff0@74
+@75
+|"+0#0000e05&| |f|o|l|d|-|r|e|g|i|o|n| |e|n|d|i|n|g| +0#0000000&@54
+@75
+|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
+| +0#0000000#ffffff0@74
+|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
+| +0#0000000#ffffff0@74
+|++0#0000e05#a8a8a8255|-@1| @1|5| |l|i|n|e|s|:| |d|e|f| |F|o@1|(|)|-@51
+| +0#0000000#ffffff0@74
+|++0#0000e05#a8a8a8255|-@1| @1|2| |l|i|n|e|s|:| |:|d|e|f| |F|o@1|(|)|-@50
> +0#0000000#ffffff0@74
-@57|1@1|0|,|0|-|1| @6|B|o|t|
+@57|1|3|0|,|0|-|1| @6|B|o|t|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_nested_00.dump b/runtime/syntax/testdir/dumps/vim_ex_def_nested_00.dump
new file mode 100644
index 0000000000..9f6d437445
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_nested_00.dump
@@ -0,0 +1,20 @@
+>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64
+|#+0#0000e05&| |V|i|m|9| |:|d|e|f| |c|o|m@1|a|n|d| |(|n|e|s|t|e|d|)| +0#0000000&@46
+@75
+|c+0#af5f00255&|l|a|s@1| +0#0000000&|T|e|s|t| @64
+@4|c+0#af5f00255&|o|n|s|t| +0#0000000&|n+0#00e0e07&|a|m|e|:+0#0000000&| |s|t|r|i|n|g| @52
+@75
+@4|d+0#af5f00255&|e|f| +0#0000000&|n|e|w|(+0#e000e06&|)| +0#0000000&@61
+@8|d+0#af5f00255&|e|f| +0#0000000&|N|a|m|e|(+0#e000e06&|)|:+0#0000000&| |s+0#00e0003&|t|r|i|n|g| +0#0000000&@48
+@12|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|G|i|v|e|N|a|m|e|(+0#e000e06&|)| +0#0000000&@43
+@16|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|"+0#e000002&|a|n|y|"| +0#0000000&@46
+@12|e+0#af5f00255&|n|d|f|u|n|c|t|i|o|n| +0#0000000&@51
+@75
+@12|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|G|i|v|e|N|a|m|e|(+0#e000e06&|)| +0#0000000&@45
+@8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60
+@75
+@8|t+0#af5f00255&|h|i|s|.|n+0#0000000&|a|m|e| |=+0#af5f00255&| +0#0000000&|N|a|m|e|(+0#e000e06&|)| +0#0000000&@48
+@4|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@64
+|e+0#af5f00255&|n|d|c|l|a|s@1| +0#0000000&@66
+@75
+@57|1|,|1| @10|T|o|p|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_nested_99.dump b/runtime/syntax/testdir/dumps/vim_ex_def_nested_99.dump
new file mode 100644
index 0000000000..15c078a5fb
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_nested_99.dump
@@ -0,0 +1,20 @@
+|#+0#0000e05#ffffff0| |V|i|m|9| |:|d|e|f| |c|o|m@1|a|n|d| |(|n|e|s|t|e|d|)| +0#0000000&@46
+@75
+|c+0#af5f00255&|l|a|s@1| +0#0000000&|T|e|s|t| @64
+@4|c+0#af5f00255&|o|n|s|t| +0#0000000&|n+0#00e0e07&|a|m|e|:+0#0000000&| |s|t|r|i|n|g| @52
+@75
+@4|d+0#af5f00255&|e|f| +0#0000000&|n|e|w|(+0#e000e06&|)| +0#0000000&@61
+@8|d+0#af5f00255&|e|f| +0#0000000&|N|a|m|e|(+0#e000e06&|)|:+0#0000000&| |s+0#00e0003&|t|r|i|n|g| +0#0000000&@48
+@12|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|G|i|v|e|N|a|m|e|(+0#e000e06&|)| +0#0000000&@43
+@16|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|"+0#e000002&|a|n|y|"| +0#0000000&@46
+@12|e+0#af5f00255&|n|d|f|u|n|c|t|i|o|n| +0#0000000&@51
+@75
+@12|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|G|i|v|e|N|a|m|e|(+0#e000e06&|)| +0#0000000&@45
+@8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60
+@75
+@8|t+0#af5f00255&|h|i|s|.|n+0#0000000&|a|m|e| |=+0#af5f00255&| +0#0000000&|N|a|m|e|(+0#e000e06&|)| +0#0000000&@48
+@4|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@64
+|e+0#af5f00255&|n|d|c|l|a|s@1| +0#0000000&@66
+@75
+>e+0#af5f00255&|c|h|o| +0#0000000&|T|e|s|t|.|n|e|w|(+0#e000e06&|)| +0#0000000&@59
+@57|2|0|,|1| @9|B|o|t|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_nested_fold_00.dump b/runtime/syntax/testdir/dumps/vim_ex_def_nested_fold_00.dump
new file mode 100644
index 0000000000..3bcaccc3d1
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_nested_fold_00.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@62
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|i|m|9| |:|d|e|f| |c|o|m@1|a|n|d| |(|n|e|s|t|e|d|)| +0#0000000&@44
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|v|i|m|s|y|n|_|f|o|l|d|i|n|g| |=| |'|f|'| +0#0000000&@29
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |s|e|t|l| |f|d|c|=|2| |f|d|m|=|s|y|n|t|a|x| +0#0000000&@34
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|l|a|s@1| +0#0000000&|T|e|s|t| @62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t| +0#0000000&|n+0#00e0e07&|a|m|e|:+0#0000000&| |s|t|r|i|n|g| @50
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|++0#0000e05#a8a8a8255| |+|-@1| |1@1| |l|i|n|e|s|:| |d|e|f| |n|e|w|(|)|-@49
+| @1|e+0#af5f00255#ffffff0|n|d|c|l|a|s@1| +0#0000000&@64
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|T|e|s|t|.|n|e|w|(+0#e000e06&|)| +0#0000000&@57
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|,|1| @10|A|l@1|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_nested_fold_01.dump b/runtime/syntax/testdir/dumps/vim_ex_def_nested_fold_01.dump
new file mode 100644
index 0000000000..c1f9fa892b
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_nested_fold_01.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |s|e|t|l| |f|d|c|=|2| |f|d|m|=|s|y|n|t|a|x| +0#0000000&@34
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|l|a|s@1| +0#0000000&|T|e|s|t| @62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t| +0#0000000&|n+0#00e0e07&|a|m|e|:+0#0000000&| |s|t|r|i|n|g| @50
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|++0#0000e05#a8a8a8255| >+|-@1| |1@1| |l|i|n|e|s|:| |d|e|f| |n|e|w|(|)|-@49
+| @1|e+0#af5f00255#ffffff0|n|d|c|l|a|s@1| +0#0000000&@64
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|T|e|s|t|.|n|e|w|(+0#e000e06&|)| +0#0000000&@57
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|9|,|5|-|1| @7|B|o|t|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_nested_fold_99.dump b/runtime/syntax/testdir/dumps/vim_ex_def_nested_fold_99.dump
new file mode 100644
index 0000000000..84a08f866e
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_nested_fold_99.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1|v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@62
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|i|m|9| |:|d|e|f| |c|o|m@1|a|n|d| |(|n|e|s|t|e|d|)| +0#0000000&@44
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|v|i|m|s|y|n|_|f|o|l|d|i|n|g| |=| |'|f|'| +0#0000000&@29
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |s|e|t|l| |f|d|c|=|2| |f|d|m|=|s|y|n|t|a|x| +0#0000000&@34
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|l|a|s@1| +0#0000000&|T|e|s|t| @62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t| +0#0000000&|n+0#00e0e07&|a|m|e|:+0#0000000&| |s|t|r|i|n|g| @50
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|++0#0000e05#a8a8a8255| |+|-@1| |1@1| |l|i|n|e|s|:| |d|e|f| |n|e|w|(|)|-@49
+| @1|e+0#af5f00255#ffffff0|n|d|c|l|a|s@1| +0#0000000&@64
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1>e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|T|e|s|t|.|n|e|w|(+0#e000e06&|)| +0#0000000&@57
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|2@1|,|1| @9|A|l@1|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_function_fold_01.dump b/runtime/syntax/testdir/dumps/vim_ex_function_fold_01.dump
index 461531d1be..9034e28a03 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_function_fold_01.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_fold_01.dump
@@ -17,4 +17,4 @@
| +0#0000000#ffffff0@74
|++0#0000e05#a8a8a8255|-@1| @1|2| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |{|"|F|"|}|{|"|o|"|}|{|"|o|"|}|(|)|-@34
| +0#0000000#ffffff0@74
-@57|1|9|,|1| @10|8|%|
+@57|1|9|,|1| @10|6|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_function_fold_02.dump b/runtime/syntax/testdir/dumps/vim_ex_function_fold_02.dump
index 3a64c7f121..17e220f4a2 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_function_fold_02.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_fold_02.dump
@@ -17,4 +17,4 @@
|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |g|:|F|o@1|(|)|-@44
| +0#0000000#ffffff0@74
|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |s|:|F|o@1|(|)|-@44
-| +0#0000000#ffffff0@56|3|7|,|1| @9|1|8|%|
+| +0#0000000#ffffff0@56|3|7|,|1| @9|1|4|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_function_fold_03.dump b/runtime/syntax/testdir/dumps/vim_ex_function_fold_03.dump
index 3f26306d7b..b229e6c9a3 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_function_fold_03.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_fold_03.dump
@@ -17,4 +17,4 @@
| +0#0000000#ffffff0@74
@75
|"+0#0000e05&| |m|o|d|i|f|i|e|r|s| +0#0000000&@63
-@57|5@1|,|0|-|1| @7|2|8|%|
+@57|5@1|,|0|-|1| @7|2@1|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_function_fold_04.dump b/runtime/syntax/testdir/dumps/vim_ex_function_fold_04.dump
index 52423a2a26..d9aa1c9f3f 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_function_fold_04.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_fold_04.dump
@@ -17,4 +17,4 @@
|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)| |a|b|o|r|t|-@40
| +0#0000000#ffffff0@74
|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)| |d|i|c|t|-@41
-| +0#0000000#ffffff0@56|7|3|,|1| @9|4|1|%|
+| +0#0000000#ffffff0@56|7|3|,|1| @9|3|2|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_function_fold_05.dump b/runtime/syntax/testdir/dumps/vim_ex_function_fold_05.dump
index d2acafc463..989c504e8b 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_function_fold_05.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_fold_05.dump
@@ -17,4 +17,4 @@
| +0#0000000#ffffff0@74
|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n|!| |F|o@1|(|)| |d|i|c|t|-@40
| +0#0000000#ffffff0@74
-@57|9|1|,|1| @9|5|4|%|
+@57|9|1|,|1| @9|4|2|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_function_fold_06.dump b/runtime/syntax/testdir/dumps/vim_ex_function_fold_06.dump
index 354af8ebb5..f6619c255e 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_function_fold_06.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_fold_06.dump
@@ -17,4 +17,4 @@
|++0#0000e05#a8a8a8255|-@1| @1|4| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)|-@46
| +0#0000000#ffffff0@74
|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)|-@46
-| +0#0000000#ffffff0@56|1|0|9|,|1| @8|6|7|%|
+| +0#0000000#ffffff0@56|1|0|9|,|1| @8|5|2|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_function_fold_07.dump b/runtime/syntax/testdir/dumps/vim_ex_function_fold_07.dump
index fc403c59b5..8e84214097 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_function_fold_07.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_fold_07.dump
@@ -17,4 +17,4 @@
| +0#0000000#ffffff0@74
|++0#0000e05#a8a8a8255|-@1| @1|7| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|-@47
| +0#0000000#ffffff0@74
-@57|1|2|7|,|0|-|1| @6|8|0|%|
+@57|1|2|7|,|0|-|1| @6|6|3|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_function_fold_08.dump b/runtime/syntax/testdir/dumps/vim_ex_function_fold_08.dump
index 4d519d0102..fb482ff925 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_function_fold_08.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_fold_08.dump
@@ -17,4 +17,4 @@
|++0#0000e05#a8a8a8255|-@1| @1|5| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)|-@46
| +0#0000000#ffffff0@74
@75
-@57|1|4|5|,|3|-|1| @6|9|5|%|
+@57|1|4|5|,|3|-|1| @6|7|4|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_function_fold_09.dump b/runtime/syntax/testdir/dumps/vim_ex_function_fold_09.dump
index 8ecc529690..4b6a2d2cd0 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_function_fold_09.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_fold_09.dump
@@ -17,4 +17,4 @@
|d+0#af5f00255&|e|l|f|u|n|c|t|i|o|n| +0#0000000&|f|o@1|.+0#af5f00255&|b+0#0000000&|a|r| @55
|d+0#af5f00255&|e|l|f|u|n|c|t|i|o|n|!| +0#0000000&|F|o@1| @58
|d+0#af5f00255&|e|l|f|u|n|c|t|i|o|n| +0#0000000&|f|o@1|.+0#af5f00255&|b+0#0000000&|a|r| @55
-@57|1|6|3|,|7|-|1| @6|9@1|%|
+@57|1|6|3|,|7|-|1| @6|7|8|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_function_fold_10.dump b/runtime/syntax/testdir/dumps/vim_ex_function_fold_10.dump
new file mode 100644
index 0000000000..2e986c456c
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_fold_10.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@74
+|"+0#0000e05&| |d|e|l|e|t|e| |f|u|n|c|t|i|o|n| +0#0000000&@57
+@75
+|d+0#af5f00255&|e|l|f|u|n|c|t|i|o|n| +0#0000000&|F|o@1| @59
+|d+0#af5f00255&|e|l|f|u|n|c|t|i|o|n| +0#0000000&|f|o@1|.+0#af5f00255&|b+0#0000000&|a|r| @55
+>d+0#af5f00255&|e|l|f|u|n|c|t|i|o|n|!| +0#0000000&|F|o@1| @58
+|d+0#af5f00255&|e|l|f|u|n|c|t|i|o|n| +0#0000000&|f|o@1|.+0#af5f00255&|b+0#0000000&|a|r| @55
+@75
+@75
+|"+0#0000e05&| |f|o|l|d|-|r|e|g|i|o|n| |e|n|d|i|n|g| +0#0000000&@54
+@75
+|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)|-@46
+| +0#0000000#ffffff0@74
+|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)|-@46
+| +0#0000000#ffffff0@74
+|++0#0000e05#a8a8a8255|-@1| @1|6| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)|-@46
+| +0#0000000#ffffff0@74
+|++0#0000e05#a8a8a8255|-@1| @1|5| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)|-@46
+| +0#0000000#ffffff0@74
+@57|1|8|1|,|1| @8|9|1|%|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_function_fold_11.dump b/runtime/syntax/testdir/dumps/vim_ex_function_fold_11.dump
new file mode 100644
index 0000000000..174e250b59
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_fold_11.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@74
+|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)|-@46
+| +0#0000000#ffffff0@74
+|++0#0000e05#a8a8a8255|-@1| @1|3| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)|-@46
+| +0#0000000#ffffff0@74
+>++0#0000e05#a8a8a8255|-@1| @1|6| |l|i|n|e|s|:| |f|u|n|c|t|i|o|n| |F|o@1|(|)|-@46
+| +0#0000000#ffffff0@74
+|++0#0000e05#a8a8a8255|-@1| @1|5| |l|i|n|e|s|:| |f