runtime(vim): Update base syntax and generator, match :cd commands

Commit: 
https://github.com/vim/vim/commit/f46616f0c4b7254cfe2153c845f33c347ef67446
Author: Doug Kearns <[email protected]>
Date:   Sat Nov 15 10:17:17 2025 +0000

    runtime(vim): Update base syntax and generator, match :cd commands
    
    Match :cd commands explicitly.
    
    fixes: #17964
    closes: #18736
    
    Reported by Maxim Kim.
    
    Signed-off-by: Doug Kearns <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/syntax/generator/gen_syntax_vim.vim 
b/runtime/syntax/generator/gen_syntax_vim.vim
index d3b645b68..4683180d0 100644
--- a/runtime/syntax/generator/gen_syntax_vim.vim
+++ b/runtime/syntax/generator/gen_syntax_vim.vim
@@ -1,7 +1,7 @@
 " Vim syntax file generator
 " Language:             Vim script
 " Maintainer:  Hirohito Higashi (h_east)
-" Last Change: 2025 Nov 11
+" Last Change: 2025 Nov 13
 
 let s:keepcpo= &cpo
 set cpo&vim
@@ -288,6 +288,7 @@ function s:get_vim_command_type(cmd_name)
        "   6: unmap
        "   7: abclear
        "   8: modifiers
+       "   9: cd
        "   99: (Exclude registration of "syn keyword")
        let ab_prefix   = '^[ci]\?'
        let menu_prefix = '^\%([acinostvx]\?\|tl\)'
@@ -459,6 +460,9 @@ function s:get_vim_command_type(cmd_name)
                let ret = 6
        elseif index(s:get_cmd_modifiers(), a:cmd_name) != -1
                let ret = 8
+       " :chdir handled specially for command/function distinction
+       elseif a:cmd_name =~# '^\%([lt]\?cd\|[lt]chdir\)$'
+               let ret = 9
        else
                let ret = 0
        endif
@@ -926,6 +930,9 @@ function s:update_syntax_vim_file(vim_info)
                " vimCommand - modifier
                let lnum = s:search_and_check(kword . ' modifier', base_fname, 
str_info)
                let lnum = s:append_syn_vimcmd(lnum, str_info, li, 8)
+               " vimCommand - cd
+               let lnum = s:search_and_check(kword . ' cd', base_fname, 
str_info)
+               let lnum = s:append_syn_vimcmd(lnum, str_info, li, 9)
 
                update
                quit!
diff --git a/runtime/syntax/generator/vim.vim.base 
b/runtime/syntax/generator/vim.vim.base
index 98873f3e1..006ffc97f 100644
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -2,7 +2,7 @@
 " Language:       Vim script
 " Maintainer:     Hirohito Higashi <h.east.727 ATMARK gmail.com>
 "         Doug Kearns <[email protected]>
-" Last Change:    2025 Nov 11
+" Last Change:    2025 Nov 13
 " Former Maintainer: Charles E. Campbell
 
 " DO NOT CHANGE DIRECTLY.
@@ -36,7 +36,7 @@ syn cluster vimCommentGroup   contains=vimTodo,@Spell
 " GEN_SYN_VIM: vimCommand normal, START_STR='syn keyword vimCommand 
contained', END_STR='nextgroup=vimBang'
 
 " Lower priority :syn-match to allow for :command/function() distinction
-syn match vimCommand "\<chd\%[ir]\>"    nextgroup=vimBang
+" :chdir is handled specially elsewhere
 syn match vimCommand "\<co\%[py]\>"     nextgroup=vimBang
 syn match vimCommand "\<d\%[elete]\>"   nextgroup=vimBang
 syn match vimCommand "\<j\%[oin]\>"     nextgroup=vimBang
@@ -246,7 +246,7 @@ syn match   vimNumber       
'\<0z\%(\x\x\)\+\%(\.\%(\x\x\)\+\)*'    skipwhite nextgroup=@vi
 syn case match
 
 " All vimCommands are contained by vimIsCommand. {{{2
-syn cluster vimCmdList 
contains=vimAbb,vimAddress,vimAt,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDefer,vimDelcommand,vimDelFunction,vimDoCommand,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimEval,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimExMark,vimFiletype,vimFor,vimFunction,vimFunctionFold,vimGrep,vimGrepAdd,vimGlobal,vimHelpgrep,vimHighlight,vimImport,vimLet,vimLoadkeymap,vimLockvar,vimMake,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimProfdel,vimProfile,vimPrompt,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimSyntime,vimSynColor,vimSynLink,vimTerminal,vimThrow,vimUniq,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,vimWincmd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList,vimLua,vimMzScheme,vimPerl,vimPython,vimPython3,vimPythonX,vimRuby,vimTcl
+syn cluster vimCmdList 
contains=vimAbb,vimAddress,vimAt,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCd,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDefer,vimDelcommand,vimDelFunction,vimDoCommand,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimEval,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimExMark,vimFiletype,vimFor,vimFunction,vimFunctionFold,vimGrep,vimGrepAdd,vimGlobal,vimHelpgrep,vimHighlight,vimImport,vimLet,vimLoadkeymap,vimLockvar,vimMake,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimProfdel,vimProfile,vimPrompt,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimSyntime,vimSynColor,vimSynLink,vimTerminal,vimThrow,vimUniq,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,vimWincmd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList,vimLua,vimMzScheme,vimPerl,vimPython,vimPython3,vimPythonX,vimRuby,vimTcl
 syn cluster vim9CmdList        
contains=vim9Abstract,vim9Class,vim9Const,vim9Enum,vim9Export,vim9Final,vim9For,vim9Interface,vim9Type,vim9Var
 syn match vimCmdSep    "\\@1<!|"       skipwhite 
nextgroup=@vimCmdList,vimSubst1,@vimFunc
 syn match vimCmdSep    ":\+"   skipwhite nextgroup=@vimCmdList,vimSubst1
@@ -311,6 +311,20 @@ syn keyword vimBehaveModel contained       mswin   xterm
 " ====
 syn match vimCall      "\<call\=\>"    skipwhite nextgroup=vimVar,@vimFunc
 
+" Cd: {{{2
+" ==
+" GEN_SYN_VIM: vimCommand cd, START_STR='syn keyword vimCd', 
END_STR='skipwhite 
nextgroup=vimCdBang,vimCdArg,vimComment,vim9Comment,vimCmdSep'
+syn match      vimCd   "\<chd\%[ir]\>" skipwhite 
nextgroup=vimCdBang,vimCdArg,vimComment,vim9Comment,vimCmdSep
+syn region     vimCdArg        contained
+      \ start=+["#|]\@!\S+
+      \ end="\ze\s*$"
+      \ end=+\ze\s*\\@1<!["#|]+
+      \ skipwhite nextgroup=vimComment,vim9Comment,vimCmdSep
+      \ contains=vimSpecfile,@vimWildCard
+      \ oneline
+
+syn match      vimCdBang       contained       " \@1<=!"       skipwhite 
nextgroup=vimCdArg,vimComment,vim9Comment,vimCmdSep
+
 " Debuggreedy {{{2
 " ===========
 " TODO: special-cased until generalised range/count support is implemented
@@ -825,6 +839,10 @@ syn match  vimSpecFile     "\s%<"ms=s+1,me=e-1     
nextgroup=vimSpecFileMod,vimSubst1
 syn match      vimSpecFile     "#\d\+\|[#%]<\>"                
nextgroup=vimSpecFileMod,vimSubst1
 syn match      vimSpecFileMod  "\(:[phtre]\)\+"        contained
 
+syn match      vimSpecFile     contained               "%[     :]"me=e-1       
nextgroup=vimSpecFileMod
+syn match      vimSpecFile     contained       excludenl       "%$"    
nextgroup=vimSpecFileMod
+syn match      vimSpecFile     contained               "%<"me=e-1      
nextgroup=vimSpecFileMod
+
 " User-Specified Commands: {{{2
 " =======================
 syn cluster    vimUserCmdList  
contains=@vimCmdList,vimCmplxRepeat,@vimComment,vimCtrlChar,vimEscapeBrace,@vimFunc,vimNotation,vimNumber,vimOper,vimRegister,vimSpecFile,vimString,vimSubst,vimSubstRep,vimSubstRange
@@ -2370,6 +2388,8 @@ if !exists("skip_vim_syntax_inits")
  hi def link vimBracket        Delimiter
  hi def link vimCall   vimCommand
  hi def link vimCatch  vimCommand
+ hi def link vimCd     vimCommand
+ hi def link vimCdBang vimBang
  hi def link vimCmplxRepeat    SpecialChar
  hi def link vimCommand        Statement
  hi def link vimCommandModifier        vimCommand
diff --git a/runtime/syntax/testdir/dumps/vim9_comments_04.dump 
b/runtime/syntax/testdir/dumps/vim9_comments_04.dump
index 22353a0de..e5606ee7b 100644
--- a/runtime/syntax/testdir/dumps/vim9_comments_04.dump
+++ b/runtime/syntax/testdir/dumps/vim9_comments_04.dump
@@ -3,7 +3,7 @@
 |#+0#0000e05&| +0#0000000&|I+0#e000e06&|s@1|u|e|:| +0#0000e05&|#|1|3|0|4|7| 
+0#0000000&@59
 @75
 |i+0#af5f00255&|f| 
+0#0000000&|!+0#af5f00255&|e+0#00e0e07&|x|i|s|t|s|(+0#e000e06&|"+0#e000002&|:|D|i|f@1|O|r|i|g|"|)+0#e000e06&|
 +0#0000000&@51
-@2>c+0#af5f00255&|o|m@1|a|n|d| +0#0000000&|D|i|f@1|O|r|i|g| 
|v+0#af5f00255&|e|r|t| +0#0000000&|n+0#af5f00255&|e|w| +0#0000000&||| 
|s+0#af5f00255&|e|t| 
+0#0000000&|b+0#e000e06&|t|=+0#af5f00255&|n+0#0000000&|o|f|i|l|e| ||| 
|r+0#af5f00255&| +0#0000000&|++0#af5f00255&@1|e+0#00e0e07&|d|i|t| 
+0#0000000&|%+0#af5f00255&@1| +0#0000000&||| |0+0#e000002&|d+0#0000000&|_| ||| 
|d+0#af5f00255&|i|f@1|t|h|i|s| +0#0000000&
+@2>c+0#af5f00255&|o|m@1|a|n|d| +0#0000000&|D|i|f@1|O|r|i|g| 
|v+0#af5f00255&|e|r|t| +0#0000000&|n+0#af5f00255&|e|w| +0#0000000&||| 
|s+0#af5f00255&|e|t| 
+0#0000000&|b+0#e000e06&|t|=+0#af5f00255&|n+0#0000000&|o|f|i|l|e| ||| 
|r+0#af5f00255&| +0#0000000&|++0#af5f00255&@1|e+0#00e0e07&|d|i|t| 
+0#0000000&|%+0#af5f00255&|%+0#00e0e07&| +0#0000000&||| 
|0+0#e000002&|d+0#0000000&|_| ||| |d+0#af5f00255&|i|f@1|t|h|i|s| +0#0000000&
 @18|\+0#e000e06&| +0#0000000&||| |w+0#af5f00255&|i|n|c|m|d| +0#0000000&|p| ||| 
|d+0#af5f00255&|i|f@1|t|h|i|s| +0#0000000&@33
 |e+0#af5f00255&|n|d|i|f| +0#0000000&@69
 @75
diff --git a/runtime/syntax/testdir/dumps/vim9_function_calls_02.dump 
b/runtime/syntax/testdir/dumps/vim9_function_calls_02.dump
index 4960c052f..db1e0130c 100644
--- a/runtime/syntax/testdir/dumps/vim9_function_calls_02.dump
+++ b/runtime/syntax/testdir/dumps/vim9_function_calls_02.dump
@@ -8,7 +8,7 @@
 |#+0#0000e05&| |f|u|n|c|t|i|o|n| +0#0000000&@64
 |c+0#00e0e07&|h|d|i|r|(+0#e000e06&|4+0#e000002&|2|)+0#e000e06&| +0#0000000&@65
 |#+0#0000e05&| |c|o|m@1|a|n|d| +0#0000000&@65
-|c+0#af5f00255&|h|d|i|r| +0#0000000&|(+0#e000e06&|4+0#e000002&|2|)+0#e000e06&| 
+0#0000000&@64
+|c+0#af5f00255&|h|d|i|r| +0#0000000&|(|4|2|)| @64
 @75
 |v+0#af5f00255&|a|r| +0#0000000&|c|o|n|f|i|r|m| |=+0#af5f00255&| 
+0#0000000&|c+0#00e0e07&|o|n|f|i|r|m|(+0#e000e06&|4+0#e000002&|2|)+0#e000e06&| 
+0#0000000&@49
 |c+0#af5f00255&|a|l@1| 
+0#0000000&|c+0#00e0e07&|o|n|f|i|r|m|(+0#e000e06&|4+0#e000002&|2|)+0#e000e06&| 
+0#0000000&@58
diff --git a/runtime/syntax/testdir/dumps/vim_ex_cd_00.dump 
b/runtime/syntax/testdir/dumps/vim_ex_cd_00.dump
new file mode 100644
index 000000000..fa388fef1
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_cd_00.dump
@@ -0,0 +1,20 @@
+>"+0#0000e05#ffffff0| |V|i|m| |:|c|d| |c|o|m@1|a|n|d|s| +0#0000000&@56
+|"+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |h|i| |l|i|n|k| |v|i|m|C|d|A|r|g| 
|T|o|d|o| +0#0000000&@36
+@75
+@75
+|c+0#af5f00255&|d| +0#0000000&@72
+|c+0#af5f00255&|d|!| +0#0000000&@71
+|c+0#af5f00255&|d| +0#0000000&@1|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0@67
+|c+0#af5f00255&|d|!| +0#0000000&|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0@67
+|c+0#af5f00255&|d| +0#0000000&@1|%+0#00e0e07&|:|h|/+0#0000001#ffff4012|f|o@1| 
+0#0000000#ffffff0@63
+|c+0#af5f00255&|d|!| +0#0000000&|%+0#00e0e07&|:|h|/+0#0000001#ffff4012|f|o@1| 
+0#0000000#ffffff0@63
+|c+0#af5f00255&|d| +0#0000000&@1|f+0#0000001#ffff4012|o@1| |b|a|r|/|b|a|z| 
+0#0000000#ffffff0@59
+|c+0#af5f00255&|d|!| +0#0000000&|f+0#0000001#ffff4012|o@1| |b|a|r|/|b|a|z| 
+0#0000000#ffffff0@59
+|c+0#af5f00255&|d| +0#0000000&@1|-+0#0000001#ffff4012| +0#0000000#ffffff0@69
+|c+0#af5f00255&|d|!| +0#0000000&|-+0#0000001#ffff4012| +0#0000000#ffffff0@69
+@75
+|c+0#af5f00255&|d| +0#0000000&|\+0#0000001#ffff4012|"|f|o@1|\|"|b|a|r|\|"| 
+0#0000000#ffffff0@59
+|c+0#af5f00255&|d| +0#0000000&|\+0#0000001#ffff4012|||f|o@1|\|||b|a|r|\||| 
+0#0000000#ffffff0@59
+|c+0#af5f00255&|d| +0#0000000&|\+0#0000001#ffff4012|#|f|o@1|\|#|b|a|r|\|#| 
+0#0000000#ffffff0@59
+|c+0#af5f00255&|d| +0#0000000&|\+0#0000001#ffff4012| |f|o@1|\| |b|a|r|\| 
+0#0000000#ffffff0@60
+@57|1|,|1| @10|T|o|p| 
diff --git a/runtime/syntax/testdir/dumps/vim_ex_cd_01.dump 
b/runtime/syntax/testdir/dumps/vim_ex_cd_01.dump
new file mode 100644
index 000000000..388e9d5e9
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_cd_01.dump
@@ -0,0 +1,20 @@
+|c+0#af5f00255#ffffff0|d|!| +0#0000000&|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@69
+@75
+|c+0#af5f00255&|d| +0#0000000&|\+0#0000001#ffff4012|"|f|o@1|\|"|b|a|r|\|"| 
+0#0000000#ffffff0@59
+|c+0#af5f00255&|d| +0#0000000&|\+0#0000001#ffff4012|||f|o@1|\|||b|a|r|\||| 
+0#0000000#ffffff0@59
+|c+0#af5f00255&|d| +0#0000000&|\+0#0000001#ffff4012|#|f|o@1|\|#|b|a|r|\|#| 
+0#0000000#ffffff0@59
+>c+0#af5f00255&|d| +0#0000000&|\+0#0000001#ffff4012| |f|o@1|\| |b|a|r|\| 
+0#0000000#ffffff0@60
+|c+0#af5f00255&|d| +0#0000000&|\+0#0000001#ffff4012@1|f|o@1|\@1|b|a|r|\@1| 
+0#0000000#ffffff0@59
+@75
+|c+0#af5f00255&|d| +0#0000000&@1|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@61
+|c+0#af5f00255&|d| +0#0000000&@1||| |e+0#af5f00255&|c|h|o| 
+0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@58
+|c+0#af5f00255&|d|!| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@61
+|c+0#af5f00255&|d|!| +0#0000000&||| |e+0#af5f00255&|c|h|o| 
+0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@58
+@75
+@75
+|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@60
+@2|c+0#af5f00255&|d| +0#0000000&@70
+@2|c+0#af5f00255&|d|!| +0#0000000&@69
+@2|c+0#af5f00255&|d| +0#0000000&@1|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0@65
+@2|c+0#af5f00255&|d|!| +0#0000000&|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0@65
+@57|1|9|,|1| @9|1|4|%| 
diff --git a/runtime/syntax/testdir/dumps/vim_ex_cd_02.dump 
b/runtime/syntax/testdir/dumps/vim_ex_cd_02.dump
new file mode 100644
index 000000000..f2fefb1ae
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_cd_02.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@1|c+0#af5f00255&|d|!| +0#0000000&|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0@65
+@2|c+0#af5f00255&|d| +0#0000000&@1|-+0#0000001#ffff4012| +0#0000000#ffffff0@67
+@2|c+0#af5f00255&|d|!| +0#0000000&|-+0#0000001#ffff4012| +0#0000000#ffffff0@67
+@75
+@2|c+0#af5f00255&|d| +0#0000000&@1|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@59
+@2>c+0#af5f00255&|d| +0#0000000&@1||| |e+0#af5f00255&|c|h|o| 
+0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@56
+@2|c+0#af5f00255&|d|!| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@59
+@2|c+0#af5f00255&|d|!| +0#0000000&||| |e+0#af5f00255&|c|h|o| 
+0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@56
+|e+0#af5f00255&|n|d|f|u|n|c|t|i|o|n| +0#0000000&@63
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@65
+@2|c+0#af5f00255&|d| +0#0000000&@70
+@2|c+0#af5f00255&|d|!| +0#0000000&@69
+@2|c+0#af5f00255&|d| +0#0000000&@1|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0@65
+@2|c+0#af5f00255&|d|!| +0#0000000&|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0@65
+@2|c+0#af5f00255&|d| +0#0000000&@1|-+0#0000001#ffff4012| +0#0000000#ffffff0@67
+@2|c+0#af5f00255&|d|!| +0#0000000&|-+0#0000001#ffff4012| +0#0000000#ffffff0@67
+@75
+@2|c+0#af5f00255&|d| +0#0000000&@1|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@59
+@57|3|7|,|3| @9|3|4|%| 
diff --git a/runtime/syntax/testdir/dumps/vim_ex_cd_03.dump 
b/runtime/syntax/testdir/dumps/vim_ex_cd_03.dump
new file mode 100644
index 000000000..1be9f06e2
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_cd_03.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@1|c+0#af5f00255&|d| +0#0000000&@1|#+0#0000e05&| |c|o|m@1|e|n|t| 
+0#0000000&@59
+@2|c+0#af5f00255&|d| +0#0000000&@1||| |e+0#af5f00255&|c|h|o| 
+0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@56
+@2|c+0#af5f00255&|d|!| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@59
+@2|c+0#af5f00255&|d|!| +0#0000000&||| |e+0#af5f00255&|c|h|o| 
+0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@56
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+> @74
+@75
+|c+0#af5f00255&|d| +0#0000000&@5||| |l+0#af5f00255&|c|d| +0#0000000&@5||| 
|t+0#af5f00255&|c|d| +0#0000000&@5||| |c+0#af5f00255&|h|d|i|r| +0#0000000&@5||| 
|l+0#af5f00255&|c|h|d|i|r| +0#0000000&@5||| |t+0#af5f00255&|c|h|d|i|r| 
+0#0000000&@5||| |e+0#af5f00255&|c
+|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@66
+|c+0#af5f00255&|d| +0#0000000&@1|-+0#0000001#ffff4012| +0#0000000#ffffff0@2||| 
|l+0#af5f00255&|c|d| +0#0000000&@1|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2||| |t+0#af5f00255&|c|d| 
+0#0000000&@1|-+0#0000001#ffff4012| +0#0000000#ffffff0@2||| 
|c+0#af5f00255&|h|d|i|r| +0#0000000&@1|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2||| |l+0#af5f00255&|c|h|d|i|r| 
+0#0000000&@1|-+0#0000001#ffff4012| +0#0000000#ffffff0@2||| 
|t+0#af5f00255&|c|h|d|i|r| +0#0000000&@1|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2||| |e+0#af5f00255&|c
+|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@66
+|c+0#af5f00255&|d| +0#0000000&@1|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0||| |l+0#af5f00255&|c|d| 
+0#0000000&@1|f+0#0000001#ffff4012|o@1| +0#0000000#ffffff0||| 
|t+0#af5f00255&|c|d| +0#0000000&@1|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0||| |c+0#af5f00255&|h|d|i|r| 
+0#0000000&@1|f+0#0000001#ffff4012|o@1| +0#0000000#ffffff0||| 
|l+0#af5f00255&|c|h|d|i|r| +0#0000000&@1|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0||| |t+0#af5f00255&|c|h|d|i|r| 
+0#0000000&@1|f+0#0000001#ffff4012|o@1| +0#0000000#ffffff0||| |e+0#af5f00255&|c
+|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@66
+|c+0#af5f00255&|d|!| +0#0000000&@4||| |l+0#af5f00255&|c|d|!| +0#0000000&@4||| 
|t+0#af5f00255&|c|d|!| +0#0000000&@4||| |c+0#af5f00255&|h|d|i|r|!| 
+0#0000000&@4||| |l+0#af5f00255&|c|h|d|i|r|!| +0#0000000&@4||| 
|t+0#af5f00255&|c|h|d|i|r|!| +0#0000000&@4||| |e+0#af5f00255&|c
+|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@66
+|c+0#af5f00255&|d|!| +0#0000000&|-+0#0000001#ffff4012| +0#0000000#ffffff0@2||| 
|l+0#af5f00255&|c|d|!| +0#0000000&|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2||| |t+0#af5f00255&|c|d|!| 
+0#0000000&|-+0#0000001#ffff4012| +0#0000000#ffffff0@2||| 
|c+0#af5f00255&|h|d|i|r|!| +0#0000000&|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2||| |l+0#af5f00255&|c|h|d|i|r|!| 
+0#0000000&|-+0#0000001#ffff4012| +0#0000000#ffffff0@2||| 
|t+0#af5f00255&|c|h|d|i|r|!| +0#0000000&|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2||| |e+0#af5f00255&|c
+|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@66
+|c+0#af5f00255&|d|!| +0#0000000&|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0||| |l+0#af5f00255&|c|d|!| 
+0#0000000&|f+0#0000001#ffff4012|o@1| +0#0000000#ffffff0||| 
|t+0#af5f00255&|c|d|!| +0#0000000&|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0||| |c+0#af5f00255&|h|d|i|r|!| 
+0#0000000&|f+0#0000001#ffff4012|o@1| +0#0000000#ffffff0||| 
|l+0#af5f00255&|c|h|d|i|r|!| +0#0000000&|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0||| |t+0#af5f00255&|c|h|d|i|r|!| 
+0#0000000&|f+0#0000001#ffff4012|o@1| +0#0000000#ffffff0||| |e+0#af5f00255&|c
+|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@66
+@57|5@1|,|0|-|1| @7|5|0|%| 
diff --git a/runtime/syntax/testdir/dumps/vim_ex_cd_04.dump 
b/runtime/syntax/testdir/dumps/vim_ex_cd_04.dump
new file mode 100644
index 000000000..ce3e8bd6c
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_cd_04.dump
@@ -0,0 +1,20 @@
+|c+0#af5f00255#ffffff0|d|!| +0#0000000&|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0||| |l+0#af5f00255&|c|d|!| 
+0#0000000&|f+0#0000001#ffff4012|o@1| +0#0000000#ffffff0||| 
|t+0#af5f00255&|c|d|!| +0#0000000&|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0||| |c+0#af5f00255&|h|d|i|r|!| 
+0#0000000&|f+0#0000001#ffff4012|o@1| +0#0000000#ffffff0||| 
|l+0#af5f00255&|c|h|d|i|r|!| +0#0000000&|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0||| |t+0#af5f00255&|c|h|d|i|r|!| 
+0#0000000&|f+0#0000001#ffff4012|o@1| +0#0000000#ffffff0||| |e+0#af5f00255&|c
+|h|o| +0#0000000&|"+0#e000002&|.@2|"| +0#0000000&@66
+@75
+|c+0#af5f00255&|d| +0#0000000&@9|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|c+0#af5f00255&|d|!| +0#0000000&@8|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+>c+0#af5f00255&|d| +0#0000000&@5|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|c+0#af5f00255&|d|!| +0#0000000&@4|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|c+0#af5f00255&|d| +0#0000000&@5|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|c+0#af5f00255&|d|!| +0#0000000&@4|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|l+0#af5f00255&|c|d| +0#0000000&@8|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|l+0#af5f00255&|c|d|!| +0#0000000&@7|"+0#0000e05&| |c|o|m@1|e|n|t| 
+0#0000000&@53
+|l+0#af5f00255&|c|d| +0#0000000&@4|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|l+0#af5f00255&|c|d|!| +0#0000000&@3|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|l+0#af5f00255&|c|d| +0#0000000&@4|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|l+0#af5f00255&|c|d|!| +0#0000000&@3|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|t+0#af5f00255&|c|d| +0#0000000&@8|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|t+0#af5f00255&|c|d|!| +0#0000000&@7|"+0#0000e05&| |c|o|m@1|e|n|t| 
+0#0000000&@53
+|t+0#af5f00255&|c|d| +0#0000000&@4|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|t+0#af5f00255&|c|d|!| +0#0000000&@3|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+@57|6@1|,|1| @9|6@1|%| 
diff --git a/runtime/syntax/testdir/dumps/vim_ex_cd_05.dump 
b/runtime/syntax/testdir/dumps/vim_ex_cd_05.dump
new file mode 100644
index 000000000..b7b7bfb5d
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_cd_05.dump
@@ -0,0 +1,20 @@
+|t+0#af5f00255#ffffff0|c|d|!| +0#0000000&@3|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|t+0#af5f00255&|c|d| +0#0000000&@4|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|t+0#af5f00255&|c|d|!| +0#0000000&@3|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|c+0#af5f00255&|h|d|i|r| +0#0000000&@6|"+0#0000e05&| |c|o|m@1|e|n|t| 
+0#0000000&@53
+|c+0#af5f00255&|h|d|i|r|!| +0#0000000&@5|"+0#0000e05&| |c|o|m@1|e|n|t| 
+0#0000000&@53
+>c+0#af5f00255&|h|d|i|r| +0#0000000&@2|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|c+0#af5f00255&|h|d|i|r|!| +0#0000000&@1|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|c+0#af5f00255&|h|d|i|r| +0#0000000&@2|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|c+0#af5f00255&|h|d|i|r|!| +0#0000000&@1|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|l+0#af5f00255&|c|h|d|i|r| +0#0000000&@5|"+0#0000e05&| |c|o|m@1|e|n|t| 
+0#0000000&@53
+|l+0#af5f00255&|c|h|d|i|r|!| +0#0000000&@4|"+0#0000e05&| |c|o|m@1|e|n|t| 
+0#0000000&@53
+|l+0#af5f00255&|c|h|d|i|r| +0#0000000&@1|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|l+0#af5f00255&|c|h|d|i|r|!| +0#0000000&|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|l+0#af5f00255&|c|h|d|i|r| +0#0000000&@1|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|l+0#af5f00255&|c|h|d|i|r|!| +0#0000000&|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|t+0#af5f00255&|c|h|d|i|r| +0#0000000&@5|"+0#0000e05&| |c|o|m@1|e|n|t| 
+0#0000000&@53
+|t+0#af5f00255&|c|h|d|i|r|!| +0#0000000&@4|"+0#0000e05&| |c|o|m@1|e|n|t| 
+0#0000000&@53
+|t+0#af5f00255&|c|h|d|i|r| +0#0000000&@1|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|t+0#af5f00255&|c|h|d|i|r|!| +0#0000000&|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+@57|8|4|,|1| @9|8|5|%| 
diff --git a/runtime/syntax/testdir/dumps/vim_ex_cd_06.dump 
b/runtime/syntax/testdir/dumps/vim_ex_cd_06.dump
new file mode 100644
index 000000000..f2ad38249
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_cd_06.dump
@@ -0,0 +1,20 @@
+|t+0#af5f00255#ffffff0|c|h|d|i|r|!| +0#0000000&|-+0#0000001#ffff4012| 
+0#0000000#ffffff0@2|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|t+0#af5f00255&|c|h|d|i|r| +0#0000000&@1|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+|t+0#af5f00255&|c|h|d|i|r|!| +0#0000000&|f+0#0000001#ffff4012|o@1| 
+0#0000000#ffffff0|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@53
+@75
+@75
+>"+0#0000e05&| |I|s@1|u|e| |#|1|7|9|6|4| |(|V|i|m| |s|c|r|i|p|t| 
|h|i|g|h|l|i|g|h|t|:| |e|n|d|i|f| |i|s| |n|o|t| |h|i|g|h|l|i|g|h|t|e|d| 
|a|f|t|e|r| |l|c|d|)| +0#0000000&@1
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|L|c|d|B|a|c|k|(+0#e000e06&|)| +0#0000000&@61
+@4|i+0#af5f00255&|f| 
+0#0000000&|g+0#00e0e07&|e|t|(+0#e000e06&|g+0#00e0e07&|:|,+0#0000000&| 
|"+0#e000002&|l|c|d|"|,+0#0000000&| |0+0#e000002&|)+0#e000e06&| +0#0000000&@50
+@8|g+0#00e0e07&|:|l+0#0000000&|c|d| |=+0#af5f00255&| +0#0000000&|0+0#e000002&| 
+0#0000000&@57
+@8|l+0#af5f00255&|c|d| +0#0000000&|-+0#0000001#ffff4012| +0#0000000#ffffff0@61
+@4|e+0#af5f00255&|n|d|i|f| +0#0000000&@65
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|0|2|,|1| @8|B|o|t| 
diff --git a/runtime/syntax/testdir/dumps/vim_ex_vimgrep_03.dump 
b/runtime/syntax/testdir/dumps/vim_ex_vimgrep_03.dump
index 4d783e4ba..f77f5c4e5 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_vimgrep_03.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_vimgrep_03.dump
@@ -15,6 +15,6 @@
 |v+0#af5f00255&|i|m|g|r|e|p| 
+0#0000000&|/+0#e000e06&|p+0#0000000&|a|\+0#e000e06&|%|(|t+0#0000000&@1|\+0#e000e06&|)|e+0#0000000&|r|n|/+0#e000e06&|
 +0#0000000&|*+0#0000001#ffff4012@1|/|*|.|t|x|t| +0#0000000#ffffff0@43
 @75
 |"+0#0000e05&| |s|p|e|c|i|a|l| |f|i|l|e|n|a|m|e| |c|h|a|r|a|c|t|e|r|s| 
+0#0000000&@45
-|v+0#af5f00255&|i|m|g|r|e|p| 
+0#0000000&|p|a|\+0#e000e06&|%|(|t+0#0000000&@1|\+0#e000e06&|)|e+0#0000000&|r|n|
 @2|%+0#0000001#ffff4012| +0#0000000#ffffff0@50
-|v+0#af5f00255&|i|m|g|r|e|p| 
+0#0000000&|/+0#e000e06&|p+0#0000000&|a|\+0#e000e06&|%|(|t+0#0000000&@1|\+0#e000e06&|)|e+0#0000000&|r|n|/+0#e000e06&|
 +0#0000000&|%+0#0000001#ffff4012| +0#0000000#ffffff0@50
+|v+0#af5f00255&|i|m|g|r|e|p| 
+0#0000000&|p|a|\+0#e000e06&|%|(|t+0#0000000&@1|\+0#e000e06&|)|e+0#0000000&|r|n|
 @2|%+0#00e0e07&| +0#0000000&@50
+|v+0#af5f00255&|i|m|g|r|e|p| 
+0#0000000&|/+0#e000e06&|p+0#0000000&|a|\+0#e000e06&|%|(|t+0#0000000&@1|\+0#e000e06&|)|e+0#0000000&|r|n|/+0#e000e06&|
 +0#0000000&|%+0#00e0e07&| +0#0000000&@50
 @57|5@1|,|0|-|1| @7|9|8|%| 
diff --git a/runtime/syntax/testdir/dumps/vim_ex_vimgrep_04.dump 
b/runtime/syntax/testdir/dumps/vim_ex_vimgrep_04.dump
index a95f118e1..df3f54fc0 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_vimgrep_04.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_vimgrep_04.dump
@@ -1,4 +1,4 @@
-|v+0#af5f00255#ffffff0|i|m|g|r|e|p| 
+0#0000000&|/+0#e000e06&|p+0#0000000&|a|\+0#e000e06&|%|(|t+0#0000000&@1|\+0#e000e06&|)|e+0#0000000&|r|n|/+0#e000e06&|
 +0#0000000&|%+0#0000001#ffff4012| +0#0000000#ffffff0@50
+|v+0#af5f00255#ffffff0|i|m|g|r|e|p| 
+0#0000000&|/+0#e000e06&|p+0#0000000&|a|\+0#e000e06&|%|(|t+0#0000000&@1|\+0#e000e06&|)|e+0#0000000&|r|n|/+0#e000e06&|
 +0#0000000&|%+0#00e0e07&| +0#0000000&@50
 > @74
 |~+0#4040ff13&| @73
 |~| @73
diff --git a/runtime/syntax/testdir/dumps/vim_function_calls_02.dump 
b/runtime/syntax/testdir/dumps/vim_function_calls_02.dump
index 3d92656c5..9de7ceebb 100644
--- a/runtime/syntax/testdir/dumps/vim_function_calls_02.dump
+++ b/runtime/syntax/testdir/dumps/vim_function_calls_02.dump
@@ -3,8 +3,8 @@
 |l+0#af5f00255&|e|t| +0#0000000&|c|h|d|i|r| |=+0#af5f00255&| 
+0#0000000&|c+0#00e0e07&|h|d|i|r|(+0#e000e06&|4+0#e000002&|2|)+0#e000e06&| 
+0#0000000&@53
 |c+0#af5f00255&|a|l@1| 
+0#0000000&|c+0#00e0e07&|h|d|i|r|(+0#e000e06&|4+0#e000002&|2|)+0#e000e06&| 
+0#0000000&@60
 |"+0#0000e05&| |c|o|m@1|a|n|d| +0#0000000&@65
->c+0#af5f00255&|h|d|i|r|(+0#e000e06&|4+0#e000002&|2|)+0#e000e06&| 
+0#0000000&@65
-|c+0#af5f00255&|h|d|i|r| +0#0000000&|(+0#e000e06&|4+0#e000002&|2|)+0#e000e06&| 
+0#0000000&@64
+>c+0#af5f00255&|h|d|i|r|(+0#0000000&|4|2|)| @65
+|c+0#af5f00255&|h|d|i|r| +0#0000000&|(|4|2|)| @64
 @75
 |l+0#af5f00255&|e|t| +0#0000000&|c|o|n|f|i|r|m| |=+0#af5f00255&| 
+0#0000000&|c+0#00e0e07&|o|n|f|i|r|m|(+0#e000e06&|4+0#e000002&|2|)+0#e000e06&| 
+0#0000000&@49
 |c+0#af5f00255&|a|l@1| 
+0#0000000&|c+0#00e0e07&|o|n|f|i|r|m|(+0#e000e06&|4+0#e000002&|2|)+0#e000e06&| 
+0#0000000&@58
diff --git a/runtime/syntax/testdir/input/vim_ex_cd.vim 
b/runtime/syntax/testdir/input/vim_ex_cd.vim
new file mode 100644
index 000000000..21adc3161
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim_ex_cd.vim
@@ -0,0 +1,110 @@
+" Vim :cd commands
+" VIM_TEST_SETUP hi link vimCdArg Todo
+
+
+cd
+cd!
+cd  foo
+cd! foo
+cd  %:h/foo
+cd! %:h/foo
+cd  foo bar/baz
+cd! foo bar/baz
+cd  -
+cd! -
+
+cd \"foo\"bar\"
+cd \|foo\|bar\|
+cd \#foo\#bar\#
+cd \ foo\ bar\ 
+cd \foo\bar\
+
+cd  " comment
+cd  | echo "..."
+cd! " comment
+cd! | echo "..."
+
+
+function Foo()
+  cd
+  cd!
+  cd  foo
+  cd! foo
+  cd  -
+  cd! -
+
+  cd  " comment
+  cd  | echo "..."
+  cd! " comment
+  cd! | echo "..."
+endfunction
+
+def Foo()
+  cd
+  cd!
+  cd  foo
+  cd! foo
+  cd  -
+  cd! -
+
+  cd  # comment
+  cd  | echo "..."
+  cd! # comment
+  cd! | echo "..."
+enddef
+
+
+cd      | lcd      | tcd      | chdir      | lchdir      | tchdir      | echo 
"..."
+cd  -   | lcd  -   | tcd  -   | chdir  -   | lchdir  -   | tchdir  -   | echo 
"..."
+cd  foo | lcd  foo | tcd  foo | chdir  foo | lchdir  foo | tchdir  foo | echo 
"..."
+cd!     | lcd!     | tcd!     | chdir!     | lchdir!     | tchdir!     | echo 
"..."
+cd! -   | lcd! -   | tcd! -   | chdir! -   | lchdir! -   | tchdir! -   | echo 
"..."
+cd! foo | lcd! foo | tcd! foo | chdir! foo | lchdir! foo | tchdir! foo | echo 
"..."
+
+cd          " comment
+cd!         " comment
+cd      -   " comment
+cd!     -   " comment
+cd      foo " comment
+cd!     foo " comment
+lcd         " comment
+lcd!        " comment
+lcd     -   " comment
+lcd!    -   " comment
+lcd     foo " comment
+lcd!    foo " comment
+tcd         " comment
+tcd!        " comment
+tcd     -   " comment
+tcd!    -   " comment
+tcd     foo " comment
+tcd!    foo " comment
+chdir       " comment
+chdir!      " comment
+chdir   -   " comment
+chdir!  -   " comment
+chdir   foo " comment
+chdir!  foo " comment
+lchdir      " comment
+lchdir!     " comment
+lchdir  -   " comment
+lchdir! -   " comment
+lchdir  foo " comment
+lchdir! foo " comment
+tchdir      " comment
+tchdir!     " comment
+tchdir  -   " comment
+tchdir! -   " comment
+tchdir  foo " comment
+tchdir! foo " comment
+
+
+" Issue #17964 (Vim script highlight: endif is not highlighted after lcd)
+
+def LcdBack()
+    if get(g:, "lcd", 0)
+        g:lcd = 0
+        lcd -
+    endif
+enddef
+
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index ece2ea7e4..ae919c1b1 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -2,7 +2,7 @@
 " Language:       Vim script
 " Maintainer:     Hirohito Higashi <h.east.727 ATMARK gmail.com>
 "         Doug Kearns <[email protected]>
-" Last Change:    2025 Nov 11
+" Last Change:    2025 Nov 13
 " Former Maintainer: Charles E. Campbell
 
 " DO NOT CHANGE DIRECTLY.
@@ -34,14 +34,14 @@ syn cluster vimCommentGroup contains=vimTodo,@Spell
 
 " regular vim commands {{{2
 " GEN_SYN_VIM: vimCommand normal, START_STR='syn keyword vimCommand 
contained', END_STR='nextgroup=vimBang'
-syn keyword vimCommand contained al[l] ar[gs] arga[dd] argd[elete] argded[upe] 
arge[dit] argg[lobal] argl[ocal] argu[ment] as[cii] b[uffer] bN[ext] ba[ll] 
bad[d] balt bd[elete] bf[irst] bl[ast] bm[odified] bn[ext] bp[revious] 
br[ewind] brea[k] breaka[dd] breakd[el] breakl[ist] buffers bun[load] 
bw[ipeout] cN[ext] cNf[ile] cabo[ve] cad[dbuffer] cadde[xpr] caddf[ile] 
caf[ter] cb[uffer] cbe[fore] cbel[ow] cbo[ttom] cc ccl[ose] cd ce[nter] cex[pr] 
cf[ile] cfir[st] cg[etfile] cgetb[uffer] cgete[xpr] changes che[ckpath] 
checkt[ime] chi[story] cl[ist] clip[reset] cla[st] clo[se] cle[arjumps] cn[ext] 
cnew[er] cnf[ile] col[der] colo[rscheme] comc[lear] comp[iler] con[tinue] 
cope[n] cp[revious] cpf[ile] cq[uit] cr[ewind] cs[cope] cst[ag] cw[indow] 
delm[arks] deb[ug] defc[ompile] nextgroup=vimBang
-syn keyword vimCommand contained di[splay] dif[fupdate] diffg[et] diffo[ff] 
diffp[atch] diffpu[t] diffs[plit] difft[his] dig[raphs] disa[ssemble] dj[ump] 
dli[st] dr[op] ds[earch] dsp[lit] e[dit] ea[rlier] em[enu] endfo[r] endt[ry] 
endw[hile] ene[w] ex exi[t] exu[sage] f[ile] files fin[d] fina[lly] fini[sh] 
fir[st] fix[del] fo[ld] foldc[lose] foldo[pen] g[lobal] go[to] gu[i] gv[im] 
h[elp] helpc[lose] helpf[ind] helpt[ags] ha[rdcopy] his[tory] ij[ump] il[ist] 
int[ro] ip[ut] is[earch] isp[lit] ju[mps] l[ist] lN[ext] lNf[ile] la[st] 
lab[ove] lan[guage] lad[dexpr] laddb[uffer] laddf[ile] laf[ter] lat[er] 
lb[uffer] lbe[fore] lbel[ow] lbo[ttom] lc[d] lch[dir] lcl[ose] lcs[cope] le[ft] 
lex[pr] lf[ile] lfir[st] lg[etfile] lgetb[uffer] lgete[xpr] lhi[story] ll 
lla[st] lli[st] nextgroup=vimBang
-syn keyword vimCommand contained lmak[e] lne[xt] lnew[er] lnf[ile] lo[adview] 
lockv[ar] lol[der] lop[en] lp[revious] lpf[ile] lr[ewind] lt[ag] lw[indow] ls 
m[ove] marks mes[sages] mk[exrc] mks[ession] mksp[ell] mkv[imrc] mkvie[w] 
mod[e] n[ext] nb[key] nbc[lose] nbs[tart] noh[lsearch] nu[mber] o[pen] 
ol[dfiles] on[ly] opt[ions] ow[nsyntax] p[rint] pa[ckadd] packl[oadall] 
pb[uffer] pc[lose] ped[it] po[p] pp[op] pre[serve] prev[ious] ps[earch] pt[ag] 
ptN[ext] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptp[revious] ptr[ewind] 
pts[elect] pu[t] pw[d] q[uit] quita[ll] qa[ll] r[ead] rec[over] red[o] redr[aw] 
redraws[tatus] redrawt[abline] redrawtabp[anel] reg[isters] res[ize] ret[ab] 
rew[ind] ri[ght] ru[ntime] rund[o] rv[iminfo] sN[ext] sa[rgument] sal[l] 
sav[eas] sb[uffer] nextgroup=vimBang
-syn keyword vimCommand contained sbN[ext] sba[ll] sbf[irst] sbl[ast] 
sbm[odified] sbn[ext] sbp[revious] sbr[ewind] scr[iptnames] scripte[ncoding] 
scriptv[ersion] scs[cope] setf[iletype] sf[ind] sfir[st] sh[ell] sim[alt] 
sig[n] sla[st] sn[ext] so[urce] spe[llgood] spelld[ump] spelli[nfo] 
spellr[epall] spellra[re] spellu[ndo] spellw[rong] spr[evious] sre[wind] st[op] 
sta[g] star[tinsert] startg[replace] startr[eplace] stopi[nsert] stj[ump] 
sts[elect] sun[hide] sus[pend] sv[iew] sync[bind] smi[le] t tN[ext] ta[g] tags 
tabc[lose] tabe[dit] tabf[ind] tabfir[st] tabm[ove] tabl[ast] tabn[ext] tabnew 
tabo[nly] tabp[revious] tabN[ext] tabr[ewind] tabs tc[d] tch[dir] te[aroff] 
tf[irst] tj[ump] tl[ast] tn[ext] tp[revious] tr[ewind] try ts[elect] u[ndo] 
undoj[oin] undol[ist] nextgroup=vimBang
-syn keyword vimCommand contained unh[ide] up[date] v[global] ve[rsion] 
vi[sual] vie[w] viu[sage] vne[w] vs[plit] w[rite] wN[ext] wa[ll] wi[nsize] 
winp[os] wl[restore] wn[ext] wp[revious] wq wqa[ll] wu[ndo] wv[iminfo] x[it] 
xa[ll] xr[estore] y[ank] z dl dell delel deletl deletel dp dep delp delep 
deletp deletep a i nextgroup=vimBang
+syn keyword vimCommand contained al[l] ar[gs] arga[dd] argd[elete] argded[upe] 
arge[dit] argg[lobal] argl[ocal] argu[ment] as[cii] b[uffer] bN[ext] ba[ll] 
bad[d] balt bd[elete] bf[irst] bl[ast] bm[odified] bn[ext] bp[revious] 
br[ewind] brea[k] breaka[dd] breakd[el] breakl[ist] buffers bun[load] 
bw[ipeout] cN[ext] cNf[ile] cabo[ve] cad[dbuffer] cadde[xpr] caddf[ile] 
caf[ter] cb[uffer] cbe[fore] cbel[ow] cbo[ttom] cc ccl[ose] ce[nter] cex[pr] 
cf[ile] cfir[st] cg[etfile] cgetb[uffer] cgete[xpr] changes che[ckpath] 
checkt[ime] chi[story] cl[ist] clip[reset] cla[st] clo[se] cle[arjumps] cn[ext] 
cnew[er] cnf[ile] col[der] colo[rscheme] comc[lear] comp[iler] con[tinue] 
cope[n] cp[revious] cpf[ile] cq[uit] cr[ewind] cs[cope] cst[ag] cw[indow] 
delm[arks] deb[ug] defc[ompile] nextgroup=vimBang
+syn keyword vimCommand contained di[splay] dif[fupdate] diffg[et] diffo[ff] 
diffp[atch] diffpu[t] diffs[plit] difft[his] dig[raphs] disa[ssemble] dj[ump] 
dli[st] dr[op] ds[earch] dsp[lit] e[dit] ea[rlier] em[enu] endfo[r] endt[ry] 
endw[hile] ene[w] ex exi[t] exu[sage] f[ile] files fin[d] fina[lly] fini[sh] 
fir[st] fix[del] fo[ld] foldc[lose] foldo[pen] g[lobal] go[to] gu[i] gv[im] 
h[elp] helpc[lose] helpf[ind] helpt[ags] ha[rdcopy] his[tory] ij[ump] il[ist] 
int[ro] ip[ut] is[earch] isp[lit] ju[mps] l[ist] lN[ext] lNf[ile] la[st] 
lab[ove] lan[guage] lad[dexpr] laddb[uffer] laddf[ile] laf[ter] lat[er] 
lb[uffer] lbe[fore] lbel[ow] lbo[ttom] lcl[ose] lcs[cope] le[ft] lex[pr] 
lf[ile] lfir[st] lg[etfile] lgetb[uffer] lgete[xpr] lhi[story] ll lla[st] 
lli[st] lmak[e] nextgroup=vimBang
+syn keyword vimCommand contained lne[xt] lnew[er] lnf[ile] lo[adview] 
lockv[ar] lol[der] lop[en] lp[revious] lpf[ile] lr[ewind] lt[ag] lw[indow] ls 
m[ove] marks mes[sages] mk[exrc] mks[ession] mksp[ell] mkv[imrc] mkvie[w] 
mod[e] n[ext] nb[key] nbc[lose] nbs[tart] noh[lsearch] nu[mber] o[pen] 
ol[dfiles] on[ly] opt[ions] ow[nsyntax] p[rint] pa[ckadd] packl[oadall] 
pb[uffer] pc[lose] ped[it] po[p] pp[op] pre[serve] prev[ious] ps[earch] pt[ag] 
ptN[ext] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptp[revious] ptr[ewind] 
pts[elect] pu[t] pw[d] q[uit] quita[ll] qa[ll] r[ead] rec[over] red[o] redr[aw] 
redraws[tatus] redrawt[abline] redrawtabp[anel] reg[isters] res[ize] ret[ab] 
rew[ind] ri[ght] ru[ntime] rund[o] rv[iminfo] sN[ext] sa[rgument] sal[l] 
sav[eas] sb[uffer] sbN[ext] nextgroup=vimBang
+syn keyword vimCommand contained sba[ll] sbf[irst] sbl[ast] sbm[odified] 
sbn[ext] sbp[revious] sbr[ewind] scr[iptnames] scripte[ncoding] scriptv[ersion] 
scs[cope] setf[iletype] sf[ind] sfir[st] sh[ell] sim[alt] sig[n] sla[st] 
sn[ext] so[urce] spe[llgood] spelld[ump] spelli[nfo] spellr[epall] spellra[re] 
spellu[ndo] spellw[rong] spr[evious] sre[wind] st[op] sta[g] star[tinsert] 
startg[replace] startr[eplace] stopi[nsert] stj[ump] sts[elect] sun[hide] 
sus[pend] sv[iew] sync[bind] smi[le] t tN[ext] ta[g] tags tabc[lose] tabe[dit] 
tabf[ind] tabfir[st] tabm[ove] tabl[ast] tabn[ext] tabnew tabo[nly] 
tabp[revious] tabN[ext] tabr[ewind] tabs te[aroff] tf[irst] tj[ump] tl[ast] 
tn[ext] tp[revious] tr[ewind] try ts[elect] u[ndo] undoj[oin] undol[ist] 
unh[ide] up[date] v[global] nextgroup=vimBang
+syn keyword vimCommand contained ve[rsion] vi[sual] vie[w] viu[sage] vne[w] 
vs[plit] w[rite] wN[ext] wa[ll] wi[nsize] winp[os] wl[restore] wn[ext] 
wp[revious] wq wqa[ll] wu[ndo] wv[iminfo] x[it] xa[ll] xr[estore] y[ank] z dl 
dell delel deletl deletel dp dep delp delep deletp deletep a i nextgroup=vimBang
 
 " Lower priority :syn-match to allow for :command/function() distinction
-syn match vimCommand "\<chd\%[ir]\>"    nextgroup=vimBang
+" :chdir is handled specially elsewhere
 syn match vimCommand "\<co\%[py]\>"     nextgroup=vimBang
 syn match vimCommand "\<d\%[elete]\>"   nextgroup=vimBang
 syn match vimCommand "\<j\%[oin]\>"     nextgroup=vimBang
@@ -300,7 +300,7 @@ syn match   vimNumber       
'\<0z\%(\x\x\)\+\%(\.\%(\x\x\)\+\)*'    skipwhite nextgroup=@vi
 syn case match
 
 " All vimCommands are contained by vimIsCommand. {{{2
-syn cluster vimCmdList 
contains=vimAbb,vimAddress,vimAt,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDefer,vimDelcommand,vimDelFunction,vimDoCommand,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimEval,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimExMark,vimFiletype,vimFor,vimFunction,vimFunctionFold,vimGrep,vimGrepAdd,vimGlobal,vimHelpgrep,vimHighlight,vimImport,vimLet,vimLoadkeymap,vimLockvar,vimMake,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimProfdel,vimProfile,vimPrompt,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimSyntime,vimSynColor,vimSynLink,vimTerminal,vimThrow,vimUniq,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,vimWincmd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList,vimLua,vimMzScheme,vimPerl,vimPython,vimPython3,vimPythonX,vimRuby,vimTcl
+syn cluster vimCmdList 
contains=vimAbb,vimAddress,vimAt,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCd,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDefer,vimDelcommand,vimDelFunction,vimDoCommand,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimEval,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimExMark,vimFiletype,vimFor,vimFunction,vimFunctionFold,vimGrep,vimGrepAdd,vimGlobal,vimHelpgrep,vimHighlight,vimImport,vimLet,vimLoadkeymap,vimLockvar,vimMake,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimProfdel,vimProfile,vimPrompt,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimSyntime,vimSynColor,vimSynLink,vimTerminal,vimThrow,vimUniq,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,vimWincmd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList,vimLua,vimMzScheme,vimPerl,vimPython,vimPython3,vimPythonX,vimRuby,vimTcl
 syn cluster vim9CmdList        
contains=vim9Abstract,vim9Class,vim9Const,vim9Enum,vim9Export,vim9Final,vim9For,vim9Interface,vim9Type,vim9Var
 syn match vimCmdSep    "\\@1<!|"       skipwhite 
nextgroup=@vimCmdList,vimSubst1,@vimFunc
 syn match vimCmdSep    ":\+"   skipwhite nextgroup=@vimCmdList,vimSubst1
@@ -365,6 +365,21 @@ syn keyword vimBehaveModel contained       mswin   xterm
 " ====
 syn match vimCall      "\<call\=\>"    skipwhite nextgroup=vimVar,@vimFunc
 
+" Cd: {{{2
+" ==
+" GEN_SYN_VIM: vimCommand cd, START_STR='syn keyword vimCd', 
END_STR='skipwhite 
nextgroup=vimCdBang,vimCdArg,vimComment,vim9Comment,vimCmdSep'
+syn keyword vimCd cd lc[d] lch[dir] tc[d] tch[dir] skipwhite 
nextgroup=vimCdBang,vimCdArg,vimComment,vim9Comment,vimCmdSep
+syn match      vimCd   "\<chd\%[ir]\>" skipwhite 
nextgroup=vimCdBang,vimCdArg,vimComment,vim9Comment,vimCmdSep
+syn region     vimCdArg        contained
+      \ start=+["#|]\@!\S+
+      \ end="\ze\s*$"
+      \ end=+\ze\s*\\@1<!["#|]+
+      \ skipwhite nextgroup=vimComment,vim9Comment,vimCmdSep
+      \ contains=vimSpecfile,@vimWildCard
+      \ oneline
+
+syn match      vimCdBang       contained       " \@1<=!"       skipwhite 
nextgroup=vimCdArg,vimComment,vim9Comment,vimCmdSep
+
 " Debuggreedy {{{2
 " ===========
 " TODO: special-cased until generalised range/count support is implemented
@@ -879,6 +894,10 @@ syn match  vimSpecFile     "\s%<"ms=s+1,me=e-1     
nextgroup=vimSpecFileMod,vimSubst1
 syn match      vimSpecFile     "#\d\+\|[#%]<\>"                
nextgroup=vimSpecFileMod,vimSubst1
 syn match      vimSpecFileMod  "\(:[phtre]\)\+"        contained
 
+syn match      vimSpecFile     contained               "%[     :]"me=e-1       
nextgroup=vimSpecFileMod
+syn match      vimSpecFile     contained       excludenl       "%$"    
nextgroup=vimSpecFileMod
+syn match      vimSpecFile     contained               "%<"me=e-1      
nextgroup=vimSpecFileMod
+
 " User-Specified Commands: {{{2
 " =======================
 syn cluster    vimUserCmdList  
contains=@vimCmdList,vimCmplxRepeat,@vimComment,vimCtrlChar,vimEscapeBrace,@vimFunc,vimNotation,vimNumber,vimOper,vimRegister,vimSpecFile,vimString,vimSubst,vimSubstRep,vimSubstRange
@@ -2432,6 +2451,8 @@ if !exists("skip_vim_syntax_inits")
  hi def link vimBracket        Delimiter
  hi def link vimCall   vimCommand
  hi def link vimCatch  vimCommand
+ hi def link vimCd     vimCommand
+ hi def link vimCdBang vimBang
  hi def link vimCmplxRepeat    SpecialChar
  hi def link vimCommand        Statement
  hi def link vimCommandModifier        vimCommand

-- 
-- 
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/E1vKDXm-004TP9-1c%40256bit.org.

Raspunde prin e-mail lui