From da5b6007fb75d4a0fb20583ffd298f032acdfc0d Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 23 Sep 2025 18:31:34 +0000 Subject: [PATCH] runtime(vim): Update base syntax, match :terminal command Match the full :terminal command syntax. closes: #18367 Signed-off-by: Doug Kearns Signed-off-by: Christian Brabandt --- runtime/syntax/generator/gen_syntax_vim.vim | 1 + runtime/syntax/generator/vim.vim.base | 49 ++++++++++++- .../testdir/dumps/vim_ex_terminal_00.dump | 20 ++++++ .../testdir/dumps/vim_ex_terminal_01.dump | 20 ++++++ .../testdir/dumps/vim_ex_terminal_02.dump | 20 ++++++ .../testdir/dumps/vim_ex_terminal_03.dump | 20 ++++++ .../testdir/dumps/vim_ex_terminal_04.dump | 20 ++++++ .../syntax/testdir/input/vim_ex_terminal.vim | 69 +++++++++++++++++++ runtime/syntax/vim.vim | 51 +++++++++++++- 9 files changed, 265 insertions(+), 5 deletions(-) create mode 100644 runtime/syntax/testdir/dumps/vim_ex_terminal_00.dump create mode 100644 runtime/syntax/testdir/dumps/vim_ex_terminal_01.dump create mode 100644 runtime/syntax/testdir/dumps/vim_ex_terminal_02.dump create mode 100644 runtime/syntax/testdir/dumps/vim_ex_terminal_03.dump create mode 100644 runtime/syntax/testdir/dumps/vim_ex_terminal_04.dump create mode 100644 runtime/syntax/testdir/input/vim_ex_terminal.vim diff --git a/runtime/syntax/generator/gen_syntax_vim.vim b/runtime/syntax/generator/gen_syntax_vim.vim index aed7426685..9e45b97f1d 100644 --- a/runtime/syntax/generator/gen_syntax_vim.vim +++ b/runtime/syntax/generator/gen_syntax_vim.vim @@ -401,6 +401,7 @@ function s:get_vim_command_type(cmd_name) tcl tcldo tclfile + terminal this throw type diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base index 69ae97d3a3..528f126a2c 100644 --- a/runtime/syntax/generator/vim.vim.base +++ b/runtime/syntax/generator/vim.vim.base @@ -245,7 +245,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,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDefer,vimDelcommand,vimDelFunction,@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,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimSynColor,vimSynLink,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,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDefer,vimDelcommand,vimDelFunction,@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,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,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=vimTerminalOptions,vimTerminalCommand +syn match vimTerminal +\\ze\s*\n\s*\%(\\\|["#]\\ \)+ skipwhite skipnl nextgroup=vimTerminalOptions,vimTerminalCommand,@vimTerminalContinue + +syn match vimTerminalContinue contained "^\s*\\" skipwhite skipnl nextgroup=@vimTerminalContinue,vimTerminalOptions,vimTerminalCommand contains=vimWhitespace +syn match vimTerminalContinueComment contained '^\s*["#]\\ .*' skipwhite skipnl nextgroup=@vimTerminalContinue,vimTerminalOptions,vimTerminalCommand contains=vimWhitespace +syn cluster vimTerminalContinue contains=vimTerminalContinue,vimTerminalContinueComment + +syn region vimTerminalCommand contained + \ start="\S" + \ skip=+\n\s*\%(\\\|["#]\\ \)+ + \ end="$" + \ contains=@vimContinue + +syn region vimTerminalOptions contained + \ start="++" + \ skip=/\s\+++\|\%(\n\|^\)\s*\%(\\\|["#]\\ \)/ + \ end="\s" + \ end="$" + \ skipwhite nextgroup=vimTerminalCommand + \ contains=@vimContinue,vimTerminalOption + \ transparent + +syn match vimTerminalOption contained "++\%(\%(no\)\=close\|open\|curwin\|hidden\|norestore\|shell\)\>" +syn match vimTerminalOption contained "++kill=" nextgroup=vimTerminalKillOptionArg +syn match vimTerminalOption contained "++\%(rows\|cols\)=" nextgroup=vimTerminalSizeOptionArg +syn match vimTerminalOption contained "++eof=" nextgroup=vimTerminalEofOptionArg +syn match vimTerminalOption contained "++type=" nextgroup=vimTerminalTypeOptionArg +syn match vimTerminalOption contained "++api=" nextgroup=vimTerminalApiOptionArg + +syn match vimTerminalApiOptionArg contained "\<\S\+\>" +syn match vimTerminalEofOptionArg contained "\<\S\+\>" +syn match vimTerminalSizeOptionArg contained "\<\d\+\>" +syn keyword vimTerminalKillOptionArg contained term hup quit int kill +syn match vimTerminalKillOptionArg contained "\<\d\+\>" +syn keyword vimTerminalTypeOptionArg contained conpty winpty + " Uniq: {{{2 " ==== syn match vimUniq "\" skipwhite nextgroup=vimUniqBang,@vimUniqOptions,vimUniqPattern,vimCmdSep @@ -1617,7 +1655,7 @@ syn cluster vimUniqOptions contains=vimUniqOptions,vimUniqOptionsError " Wincmd: {{{2 " ====== -syn match vimWincmd "\" skipwhite nextgroup=vimWincmdArg +syn match vimWincmd "\" skipwhite nextgroup=vimWincmdArg " TODO: consider extracting this list from the help file syn match vimWincmdArg contained \ "\<[sSvnqojkhlwWtbpPrRxKJHLTfFz]\>\|[\^:=\-+_<>|\]}]\|\" @@ -2521,6 +2559,13 @@ if !exists("skip_vim_syntax_inits") hi def link vimSyntax vimCommand hi def link vimSynType vimSpecial hi def link vimTcl vimCommand + hi def link vimTerminal vimCommand + hi def link vimTerminalContinue vimContinue + hi def link vimTerminalContinueComment vimContinueComment + hi def link vimTerminalOption vimSpecial + hi def link vimTerminalKillOptionArg Constant + hi def link vimTerminalSizeOptionArg Constant + hi def link vimTerminalTypeOptionArg Constant hi def link vimThrow vimCommand hi def link vimTodo Todo hi def link vimType Type diff --git a/runtime/syntax/testdir/dumps/vim_ex_terminal_00.dump b/runtime/syntax/testdir/dumps/vim_ex_terminal_00.dump new file mode 100644 index 0000000000..52ce080878 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_terminal_00.dump @@ -0,0 +1,20 @@ +>"+0#0000e05#ffffff0| |V|i|m| |:|t|e|r|m|i|n|a|l| |c|o|m@1|a|n|d| +0#0000000&@51 +|"+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |h|i| |l|i|n|k| |v|i|m|T|e|r|m|i|n|a|l|C|o|m@1|a|n|d| |T|o|d|o| +0#0000000&@26 +@75 +@75 +|t+0#af5f00255&|e|r|m|i|n|a|l| +0#0000000&@66 +|t+0#af5f00255&|e|r|m|i|n|a|l| +0#0000000&|++0#00e0003&@1|k|i|l@1|=|t+0#e000002&|e|r|m| +0#0000000&|t+0#0000001#ffff4012|a|i|l| |-|f| |/|t|m|p|/|l|o|g| +0#0000000#ffffff0@37 +|t+0#af5f00255&|e|r|m|i|n|a|l| +0#0000000&|++0#00e0003&@1|h|i|d@1|e|n| +0#0000000&|++0#00e0003&@1|o|p|e|n| +0#0000000&|m+0#0000001#ffff4012|a|k|e| +0#0000000#ffffff0@45 +@75 +@75 +|"+0#0000e05&| |l|i|n|e| |c|o|n|t|i|n|u|a|t|i|o|n|s| +0#0000000&@54 +@75 +|t+0#af5f00255&|e|r|m|i|n|a|l| +0#0000000&|++0#00e0003&@1|k|i|l@1|=|t+0#e000002&|e|r|m| +0#0000000&|++0#00e0003&@1|h|i|d@1|e|n| +0#0000000&|t+0#0000001#ffff4012|a|i|l| +0#0000000#ffffff0@40 +| +0#0000001#ffff4012@5|\+0#e000e06#ffffff0| +0#0000001#ffff4012|-|f| +0#0000000#ffffff0@64 +| +0#0000001#ffff4012@5|\+0#e000e06#ffffff0| +0#0000001#ffff4012|/|t|m|p|/|l|o|g| +0#0000000#ffffff0@58 +|t+0#af5f00255&|e|r|m|i|n|a|l| +0#0000000&|++0#00e0003&@1|k|i|l@1|=|t+0#e000002&|e|r|m| +0#0000000&|++0#00e0003&@1|h|i|d@1|e|n| +0#0000000&@45 +@6|\+0#e000e06&| +0#0000000&|t+0#0000001#ffff4012|a|i|l| +0#0000000#ffffff0@62 +| +0#0000001#ffff4012@5|\+0#e000e06#ffffff0| +0#0000001#ffff4012|-|f| +0#0000000#ffffff0@64 +| +0#0000001#ffff4012@5|\+0#e000e06#ffffff0| +0#0000001#ffff4012|/|t|m|p|/|l|o|g| +0#0000000#ffffff0@58 +|t+0#af5f00255&|e|r|m|i|n|a|l| +0#0000000&|++0#00e0003&@1|k|i|l@1|=|t+0#e000002&|e|r|m| +0#0000000&@54 +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_ex_terminal_01.dump b/runtime/syntax/testdir/dumps/vim_ex_terminal_01.dump new file mode 100644 index 0000000000..2058a78942 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_terminal_01.dump @@ -0,0 +1,20 @@ +| +0#0000001#ffff4012@5|\+0#e000e06#ffffff0| +0#0000001#ffff4012|/|t|m|p|/|l|o|g| +0#0000000#ffffff0@58 +|t+0#af5f00255&|e|r|m|i|n|a|l| +0#0000000&|++0#00e0003&@1|k|i|l@1|=|t+0#e000002&|e|r|m| +0#0000000&|++0#00e0003&@1|h|i|d@1|e|n| +0#0000000&@45 +@6|\+0#e000e06&| +0#0000000&|t+0#0000001#ffff4012|a|i|l| +0#0000000#ffffff0@62 +| +0#0000001#ffff4012@5|\+0#e000e06#ffffff0| +0#0000001#ffff4012|-|f| +0#0000000#ffffff0@64 +| +0#0000001#ffff4012@5|\+0#e000e06#ffffff0| +0#0000001#ffff4012|/|t|m|p|/|l|o|g| +0#0000000#ffffff0@58 +>t+0#af5f00255&|e|r|m|i|n|a|l| +0#0000000&|++0#00e0003&@1|k|i|l@1|=|t+0#e000002&|e|r|m| +0#0000000&@54 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|h|i|d@1|e|n| +0#0000000&@58 +@6|\+0#e000e06&| +0#0000000&|t+0#0000001#ffff4012|a|i|l| +0#0000000#ffffff0@62 +| +0#0000001#ffff4012@5|\+0#e000e06#ffffff0| +0#0000001#ffff4012|-|f| +0#0000000#ffffff0@64 +| +0#0000001#ffff4012@5|\+0#e000e06#ffffff0| +0#0000001#ffff4012|/|t|m|p|/|l|o|g| +0#0000000#ffffff0@58 +|t+0#af5f00255&|e|r|m|i|n|a|l| +0#0000000&@66 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|k|i|l@1|=|t+0#e000002&|e|r|m| +0#0000000&@55 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|h|i|d@1|e|n| +0#0000000&@58 +@6|\+0#e000e06&| +0#0000000&|t+0#0000001#ffff4012|a|i|l| +0#0000000#ffffff0@62 +| +0#0000001#ffff4012@5|\+0#e000e06#ffffff0| +0#0000001#ffff4012|-|f| +0#0000000#ffffff0@64 +| +0#0000001#ffff4012@5|\+0#e000e06#ffffff0| +0#0000001#ffff4012|/|t|m|p|/|l|o|g| +0#0000000#ffffff0@58 +|t+0#af5f00255&|e|r|m|i|n|a|l| +0#0000000&@66 +@6|"+0#0000e05&|\| +0#0000000&|c+0#0000e05&|o|m@1|e|n|t| +0#0000000&@58 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|k|i|l@1|=|t+0#e000002&|e|r|m| +0#0000000&@55 +@57|1|9|,|1| @9|2|6|%| diff --git a/runtime/syntax/testdir/dumps/vim_ex_terminal_02.dump b/runtime/syntax/testdir/dumps/vim_ex_terminal_02.dump new file mode 100644 index 0000000000..1ed13e510d --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_terminal_02.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@5|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|k|i|l@1|=|t+0#e000002&|e|r|m| +0#0000000&@55 +@6|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@58 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|h|i|d@1|e|n| +0#0000000&@58 +@6|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@58 +@6|\+0#e000e06&| +0#0000000&|t+0#0000001#ffff4012|a|i|l| +0#0000000#ffffff0@62 +| +0#0000001#ffff4012@5>"+0#0000e05#ffffff0|\| |c|o|m@1|e|n|t| +0#0000000&@58 +| +0#0000001#ffff4012@5|\+0#e000e06#ffffff0| +0#0000001#ffff4012|-|f| +0#0000000#ffffff0@64 +| +0#0000001#ffff4012@5|"+0#0000e05#ffffff0|\| |c|o|m@1|e|n|t| +0#0000000&@58 +| +0#0000001#ffff4012@5|\+0#e000e06#ffffff0| +0#0000001#ffff4012|/|t|m|p|/|l|o|g| +0#0000000#ffffff0@58 +@75 +@75 +|"+0#0000e05&| |a|l@1| |o|p|t|i|o|n|s| +0#0000000&@61 +@75 +|t+0#af5f00255&|e|r|m|i|n|a|l| +0#0000000&|++0#00e0003&@1|c|l|o|s|e| +0#0000000&|++0#00e0003&@1|n|o|c|l|o|s|e| +0#0000000&|++0#00e0003&@1|o|p|e|n| +0#0000000&|++0#00e0003&@1|c|u|r|w|i|n| +0#0000000&|++0#00e0003&@1|h|i|d@1|e|n| +0#0000000&|++0#00e0003&@1|n|o|r|e|s|t|o|r|e| +0#0000000&|++0#00e0003&@1|s|h|e|l@1| +0#0000000&|++0#00e0003&@1|k +|i|l@1|=|t+0#e000002&|e|r|m| +0#0000000&|++0#00e0003&@1|r|o|w|s|=|4+0#e000002&|2| +0#0000000&|++0#00e0003&@1|c|o|l|s|=|4+0#e000002&|2| +0#0000000&|++0#00e0003&@1|e|o|f|=|e+0#0000000&|x|i|t| |++0#00e0003&@1|t|y|p|e|=|c+0#e000002&|o|n|p|t|y| +0#0000000&|++0#00e0003&@1|a|p|i|=|T+0#0000000&|a|p|i|_| |t+0#0000001#ffff4012|a|i|l| |-|f| |/ +|t|m|p|/|l|o|g| +0#0000000#ffffff0@67 +|t+0#af5f00255&|e|r|m|i|n|a|l| +0#0000000&@66 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|c|l|o|s|e| +0#0000000&@59 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|n|o|c|l|o|s|e| +0#0000000&@57 +@57|3|7|,|7| @9|5|9|%| diff --git a/runtime/syntax/testdir/dumps/vim_ex_terminal_03.dump b/runtime/syntax/testdir/dumps/vim_ex_terminal_03.dump new file mode 100644 index 0000000000..4701fa3d7a --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_terminal_03.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@5|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|n|o|c|l|o|s|e| +0#0000000&@57 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|o|p|e|n| +0#0000000&@60 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|c|u|r|w|i|n| +0#0000000&@58 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|h|i|d@1|e|n| +0#0000000&@58 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|n|o|r|e|s|t|o|r|e| +0#0000000&@55 +@6>\+0#e000e06&| +0#0000000&|++0#00e0003&@1|s|h|e|l@1| +0#0000000&@59 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|k|i|l@1|=|t+0#e000002&|e|r|m| +0#0000000&@55 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|r|o|w|s|=|4+0#e000002&|2| +0#0000000&@57 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|c|o|l|s|=|4+0#e000002&|2| +0#0000000&@57 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|e|o|f|=|e+0#0000000&|x|i|t| @56 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|t|y|p|e|=|c+0#e000002&|o|n|p|t|y| +0#0000000&@53 +@6|\+0#e000e06&| +0#0000000&|++0#00e0003&@1|a|p|i|=|T+0#0000000&|a|p|i|_| @55 +@6|\+0#e000e06&| +0#0000000&|t+0#0000001#ffff4012|a|i|l| +0#0000000#ffffff0@62 +| +0#0000001#ffff4012@5|\+0#e000e06#ffffff0| +0#0000001#ffff4012|-|f| +0#0000000#ffffff0@64 +| +0#0000001#ffff4012@5|\+0#e000e06#ffffff0| +0#0000001#ffff4012|/|t|m|p|/|l|o|g| +0#0000000#ffffff0@58 +@75 +@75 +|"+0#0000e05&| |e|s|c|a|p|e|d| |o|p|t|i|o|n| |p|r|e|f|i|x| |+@1| +0#0000000&@48 +@75 +@57|5|3|,|7| @9|9|4|%| diff --git a/runtime/syntax/testdir/dumps/vim_ex_terminal_04.dump b/runtime/syntax/testdir/dumps/vim_ex_terminal_04.dump new file mode 100644 index 0000000000..0609af5aa7 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_terminal_04.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@74 +|t+0#af5f00255&|e|r|m|i|n|a|l| +0#0000000&|\+0#0000001#ffff4012|+@1|c|l|o|s|e| +0#0000000#ffffff0@57 +|t+0#af5f00255&|e|r|m|i|n|a|l| +0#0000000&|++0#00e0003&@1|c|l|o|s|e| +0#0000000&|\+0#0000001#ffff4012|+@1|n|o|c|l|o|s|e| +0#0000000#ffffff0@47 +> @74 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +| +0#0000000&@56|6|9|,|0|-|1| @7|B|o|t| diff --git a/runtime/syntax/testdir/input/vim_ex_terminal.vim b/runtime/syntax/testdir/input/vim_ex_terminal.vim new file mode 100644 index 0000000000..8fc6e04a11 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_terminal.vim @@ -0,0 +1,69 @@ +" Vim :terminal command +" VIM_TEST_SETUP hi link vimTerminalCommand Todo + + +terminal +terminal ++kill=term tail -f /tmp/log +terminal ++hidden ++open make + + +" line continuations + +terminal ++kill=term ++hidden tail + \ -f + \ /tmp/log +terminal ++kill=term ++hidden + \ tail + \ -f + \ /tmp/log +terminal ++kill=term + \ ++hidden + \ tail + \ -f + \ /tmp/log +terminal + \ ++kill=term + \ ++hidden + \ tail + \ -f + \ /tmp/log +terminal + "\ comment + \ ++kill=term + "\ comment + \ ++hidden + "\ comment + \ tail + "\ comment + \ -f + "\ comment + \ /tmp/log + + +" all options + +terminal ++close ++noclose ++open ++curwin ++hidden ++norestore ++shell ++kill=term ++rows=42 ++cols=42 ++eof=exit ++type=conpty ++api=Tapi_ tail -f /tmp/log +terminal + \ ++close + \ ++noclose + \ ++open + \ ++curwin + \ ++hidden + \ ++norestore + \ ++shell + \ ++kill=term + \ ++rows=42 + \ ++cols=42 + \ ++eof=exit + \ ++type=conpty + \ ++api=Tapi_ + \ tail + \ -f + \ /tmp/log + + +" escaped option prefix ++ + +terminal \++close +terminal ++close \++noclose + diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index e8f86d7d02..16064f7120 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -37,7 +37,7 @@ syn keyword vimCommand contained al[l] ar[gs] arga[dd] argd[elete] argdo argded[ syn keyword vimCommand contained cq[uit] cr[ewind] cs[cope] cst[ag] cw[indow] delm[arks] deb[ug] defc[ompile] 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] foldd[oopen] folddoc[losed] foldo[pen] g[lobal] go[to] gu[i] gv[im] h[elp] helpc[lose] helpf[ind] helpt[ags] ha[rdcopy] hi[ghlight] 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] nextgroup=vimBang syn keyword vimCommand contained lcl[ose] lcs[cope] ld[o] le[ft] lex[pr] lf[ile] lfd[o] lfir[st] lg[etfile] lgetb[uffer] lgete[xpr] lgr[ep] lgrepa[dd] lhi[story] ll lla[st] lli[st] 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 menut[ranslate] 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] pro[mptfind] promptr[epl] 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] nextgroup=vimBang syn keyword vimCommand contained red[o] redr[aw] redraws[tatus] redrawt[abline] redrawtabp[anel] reg[isters] res[ize] ret[ab] rew[ind] ri[ght] ru[ntime] rub[y] rubyd[o] rubyf[ile] rund[o] rv[iminfo] sN[ext] sa[rgument] sal[l] sav[eas] sb[uffer] 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] synti[me] sync[bind] smi[le] t tN[ext] ta[g] tags tabc[lose] tabd[o] tabe[dit] nextgroup=vimBang -syn keyword vimCommand contained 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] ter[minal] tf[irst] tj[ump] tl[ast] tn[ext] tp[revious] tr[ewind] try ts[elect] u[ndo] undoj[oin] undol[ist] unh[ide] unlo[ckvar] up[date] v[global] ve[rsion] vi[sual] vie[w] viu[sage] vne[w] vs[plit] w[rite] wN[ext] wa[ll] wi[nsize] wind[o] 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 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] unh[ide] unlo[ckvar] up[date] v[global] ve[rsion] vi[sual] vie[w] viu[sage] vne[w] vs[plit] w[rite] wN[ext] wa[ll] wi[nsize] wind[o] 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 "\" nextgroup=vimBang @@ -299,7 +299,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,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDefer,vimDelcommand,vimDelFunction,@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,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimSynColor,vimSynLink,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,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimCommandModifier,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDefer,vimDelcommand,vimDelFunction,@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,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,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=vimTerminalOptions,vimTerminalCommand +syn match vimTerminal +\\ze\s*\n\s*\%(\\\|["#]\\ \)+ skipwhite skipnl nextgroup=vimTerminalOptions,vimTerminalCommand,@vimTerminalContinue + +syn match vimTerminalContinue contained "^\s*\\" skipwhite skipnl nextgroup=@vimTerminalContinue,vimTerminalOptions,vimTerminalCommand contains=vimWhitespace +syn match vimTerminalContinueComment contained '^\s*["#]\\ .*' skipwhite skipnl nextgroup=@vimTerminalContinue,vimTerminalOptions,vimTerminalCommand contains=vimWhitespace +syn cluster vimTerminalContinue contains=vimTerminalContinue,vimTerminalContinueComment + +syn region vimTerminalCommand contained + \ start="\S" + \ skip=+\n\s*\%(\\\|["#]\\ \)+ + \ end="$" + \ contains=@vimContinue + +syn region vimTerminalOptions contained + \ start="++" + \ skip=/\s\+++\|\%(\n\|^\)\s*\%(\\\|["#]\\ \)/ + \ end="\s" + \ end="$" + \ skipwhite nextgroup=vimTerminalCommand + \ contains=@vimContinue,vimTerminalOption + \ transparent + +syn match vimTerminalOption contained "++\%(\%(no\)\=close\|open\|curwin\|hidden\|norestore\|shell\)\>" +syn match vimTerminalOption contained "++kill=" nextgroup=vimTerminalKillOptionArg +syn match vimTerminalOption contained "++\%(rows\|cols\)=" nextgroup=vimTerminalSizeOptionArg +syn match vimTerminalOption contained "++eof=" nextgroup=vimTerminalEofOptionArg +syn match vimTerminalOption contained "++type=" nextgroup=vimTerminalTypeOptionArg +syn match vimTerminalOption contained "++api=" nextgroup=vimTerminalApiOptionArg + +syn match vimTerminalApiOptionArg contained "\<\S\+\>" +syn match vimTerminalEofOptionArg contained "\<\S\+\>" +syn match vimTerminalSizeOptionArg contained "\<\d\+\>" +syn keyword vimTerminalKillOptionArg contained term hup quit int kill +syn match vimTerminalKillOptionArg contained "\<\d\+\>" +syn keyword vimTerminalTypeOptionArg contained conpty winpty + " Uniq: {{{2 " ==== syn match vimUniq "\" skipwhite nextgroup=vimUniqBang,@vimUniqOptions,vimUniqPattern,vimCmdSep @@ -1679,7 +1717,7 @@ syn cluster vimUniqOptions contains=vimUniqOptions,vimUniqOptionsError " Wincmd: {{{2 " ====== -syn match vimWincmd "\" skipwhite nextgroup=vimWincmdArg +syn match vimWincmd "\" skipwhite nextgroup=vimWincmdArg " TODO: consider extracting this list from the help file syn match vimWincmdArg contained \ "\<[sSvnqojkhlwWtbpPrRxKJHLTfFz]\>\|[\^:=\-+_<>|\]}]\|\" @@ -2583,6 +2621,13 @@ if !exists("skip_vim_syntax_inits") hi def link vimSyntax vimCommand hi def link vimSynType vimSpecial hi def link vimTcl vimCommand + hi def link vimTerminal vimCommand + hi def link vimTerminalContinue vimContinue + hi def link vimTerminalContinueComment vimContinueComment + hi def link vimTerminalOption vimSpecial + hi def link vimTerminalKillOptionArg Constant + hi def link vimTerminalSizeOptionArg Constant + hi def link vimTerminalTypeOptionArg Constant hi def link vimThrow vimCommand hi def link vimTodo Todo hi def link vimType Type -- 2.47.3