0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

runtime(vim): Update-base-syntax, match full :*grep, :make, :sort and :filter commands

closes: #17082

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Doug Kearns
2025-04-10 19:59:22 +02:00
committed by Christian Brabandt
parent b0e19f9e1b
commit 9b171bdfd6
26 changed files with 836 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
" Vim syntax file generator
" Language: Vim script
" Maintainer: Hirohito Higashi (h_east)
" Last Change: 2025 Apr 06
" Last Change: 2025 Apr 10
let s:keepcpo= &cpo
set cpo&vim
@@ -284,14 +284,22 @@ function s:get_vim_command_type(cmd_name)
enum
execute
export
filter
final
for
function
grep
grepadd
helpgrep
if
interface
insert
let
loadkeymap
lhelpgrep
lvimgrep
lvimgrepadd
make
map
mapclear
match
@@ -308,6 +316,7 @@ function s:get_vim_command_type(cmd_name)
sleep
smagic
snomagic
sort
static
substitute
syntax
@@ -318,6 +327,8 @@ function s:get_vim_command_type(cmd_name)
unmap
var
vim9script
vimgrep
vimgrepadd
while
EOL
" Required for original behavior

View File

@@ -2,7 +2,7 @@
" Language: Vim script
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougkearns@gmail.com>
" Last Change: 2025 Apr 06
" Last Change: 2025 Apr 10
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -230,7 +230,7 @@ syn match vimNumber '\<0z\%(\x\x\)\+\%(\.\%(\x\x\)\+\)*' skipwhite nextgroup=vim
syn case match
" All vimCommands are contained by vimIsCommand. {{{2
syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCall,vimCatch,vimConst,vimDebuggreedy,vimDef,vimDefFold,vimDelcommand,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimFuncFold,vimGlobal,vimHighlight,vimLet,vimLoadkeymap,vimLockvar,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimRedir,vimSet,vimSleep,vimSyntax,vimThrow,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList
syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCall,vimCatch,vimConst,vimDebuggreedy,vimDef,vimDefFold,vimDelcommand,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimFor,vimFunction,vimFuncFold,vimGrep,vimGrepAdd,vimGlobal,vimHelpgrep,vimHighlight,vimLet,vimLoadkeymap,vimLockvar,vimMake,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimThrow,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList
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
@@ -923,6 +923,93 @@ syn cluster vimEcho contains=vimEcho,vimEchohl
syn region vimExecute matchgroup=vimCommand start="\<exe\%[cute]\>" skip=+\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|" excludenl end="$" contains=@vimContinue,@vimExprList transparent
" Filter: {{{2
" ======
syn match vimExFilter "\<filt\%[er]\>" skipwhite nextgroup=vimExFilterBang,vimExFilterPattern
syn match vimExFilterBang contained "\a\@1<=!" skipwhite nextgroup=vimExFilterPattern
syn region vimExFilterPattern contained
\ start="[[:ident:]]"
\ end="\ze[[:space:]\n]"
\ skipwhite nextgroup=@vimCmdList
\ contains=@vimSubstList
\ oneline
syn region vimExFilterPattern contained
\ matchgroup=Delimiter
\ start="\z([^[:space:][:ident:]|"]\)"
\ skip="\\\\\|\\\z1"
\ end="\z1"
\ skipwhite nextgroup=@vimCmdList
\ contains=@vimSubstList
\ oneline
" Grep and Make: {{{2
" =============
" | is the command separator, escaped with \| all other backslashes are passed through literally, no tail comments
syn match vimGrep "\<l\=gr\%[ep]\>" skipwhite nextgroup=vimGrepBang,vimGrepArgs,vimCmdSep
syn match vimGrepadd "\<l\=grepa\%[dd]\>" skipwhite nextgroup=vimGrepBang,vimGrepArgs,vimCmdSep
syn region vimGrepArgs contained
\ start="|\@!\S"
\ skip=+\n\s*\%(\\\|[#"]\\ \)+
\ matchgroup=vimCmdSep
\ end="|"
\ end="$"
"\ TODO: include vimSpecFile
\ contains=vimGrepBarEscape
syn match vimGrepBarEscape contained "\\|"
syn match vimGrepBang contained "\a\@1<=!" skipwhite nextgroup=vimGrepArgs,vimCmdSep
syn match vimMake "\<l\=make\=\>" skipwhite nextgroup=vimMakeBang,vimMakeArgs,vimCmdSep
syn region vimMakeArgs contained
\ start="|\@!\S"
\ skip=+\n\s*\%(\\\|[#"]\\ \)+
\ matchgroup=vimCmdSep
\ end="|"
\ end="$"
"\ TODO: include vimSpecFile
\ contains=vimMakeBarEscape
syn match vimMakeBarEscape contained "\\|"
syn match vimMakeBang contained "\a\@1<=!" skipwhite nextgroup=vimMakeArgs,vimCmdSep
syn match vimHelpgrep "\<l\=helpg\%[rep]\>" skipwhite nextgroup=vimHelpgrepBang,vimHelpgrepPattern
syn region vimHelpgrepPattern contained
\ start="\S"
\ matchgroup=Special
\ end="@\w\w\>"
\ end="$"
\ contains=@vimSubstList
\ oneline
" Vimgrep: {{{2
" =======
syn match vimVimgrep "\<l\=vim\%[grep]\>" skipwhite nextgroup=vimVimgrepBang,vimVimgrepPattern
syn match vimVimgrepadd "\<l\=vimgrepa\%[dd]\>" skipwhite nextgroup=vimVimgrepBang,vimVimgrepPattern
syn match vimVimgrepBang contained "\a\@1<=!" skipwhite nextgroup=vimVimgrepPattern
syn region vimVimgrepPattern contained
\ start="[[:ident:]]"
\ end="\ze[[:space:]\n]"
\ skipwhite nextgroup=vimVimgrepFile,vimCmdSep
\ contains=@vimSubstList
\ oneline
syn region vimVimgrepPattern contained
\ matchgroup=Delimiter
\ start="\z([^[:space:][:ident:]|"]\)"
\ skip="\\\\\|\\\z1"
\ end="\z1"
\ skipwhite nextgroup=vimVimgrepFlags,vimVimgrepFile,vimCmdSep
\ contains=@vimSubstList
\ oneline
syn match vimVimgrepEscape contained "\\\%(\\|\|.\)"
syn match vimVimgrepBarEscape contained "\\|"
syn region vimVimgrepFile contained
\ start="|\@!\S"
\ matchgroup=vimCmdSep
\ end="|"
\ end="\ze\s"
\ end="$"
\ skipwhite nextgroup=vimVimgrepFile
\ contains=vimSpecFile,vimVimgrepEscape,vimVimgrepBarEscape
syn match vimVimgrepFlags contained "\<[gjf]\{,3\}\>" skipwhite nextgroup=vimVimgrepfile
" Maps: {{{2
" ====
" GEN_SYN_VIM: vimCommand map, START_STR='syn keyword vimMap', END_STR='skipwhite nextgroup=vimMapMod,vimMapLhs'
@@ -1067,6 +1154,23 @@ syn keyword vimSleep sl[eep] skipwhite nextgroup=vimSleepBang,vimSleepArg
syn match vimSleepBang contained "\a\@1<=!" skipwhite nextgroup=vimSleepArg
syn match vimSleepArg contained "\<\%(\d\+\)\=m\=\>"
" Sort: {{{2
" ====
syn match vimSort "\<sort\=\>" skipwhite nextgroup=vimSortBang,@vimSortOptions,vimSortPattern,vimCmdSep
syn match vimSortBang contained "\a\@1<=!" skipwhite nextgroup=@vimSortOptions,vimSortPattern,vimCmdSep
syn match vimSortOptionsError contained "\a\+"
syn match vimSortOptions contained "\<[ilur]*[nfxob]\=[ilur]*\>" skipwhite nextgroup=vimSortPattern,vimCmdSep
syn region vimSortPattern contained
\ matchgroup=Delimiter
\ start="\z([^[:space:][:alpha:]|]\)"
\ skip="\\\\\|\\\z1"
\ end="\z1"
\ skipwhite nextgroup=@vimSortOptions,vimCmdSep
\ contains=@vimSubstList
\ oneline
syn cluster vimSortOptions contains=vimSortOptions,vimSortOptionsError
" Syntax: {{{2
"=======
syn match vimGroupList contained "[^[:space:],]\+\%(\s*,\s*[^[:space:],]\+\)*" contains=vimGroupSpecial
@@ -1525,6 +1629,7 @@ if !exists("skip_vim_syntax_inits")
hi def link vimHiKeyError vimError
hi def link vimMapModErr vimError
hi def link vimShebangError vimError
hi def link vimSortOptionsError Error
hi def link vimSubstFlagErr vimError
hi def link vimSynCaseError vimError
hi def link vimSyncError vimError
@@ -1581,6 +1686,8 @@ if !exists("skip_vim_syntax_inits")
hi def link vimEnvvar PreProc
hi def link vimError Error
hi def link vimEscape Special
hi def link vimExFilter vimCommand
hi def link vimExFilterBang vimCommand
hi def link vimFBVar vimVar
hi def link vimFgBgAttrib vimHiAttrib
hi def link vimFuncEcho vimCommand
@@ -1598,11 +1705,15 @@ if !exists("skip_vim_syntax_inits")
hi def link vimFuncParamEquals vimOper
hi def link vimFuncScope vimVarScope
hi def link vimFuncSID vimNotation
hi def link vimGrep vimCommand
hi def link vimGrepadd vimCommand
hi def link vimGrepBang vimBang
hi def link vimGroupAdd vimSynOption
hi def link vimGroupName Normal
hi def link vimGroupRem vimSynOption
hi def link vimGroupSpecial Special
hi def link vimGroup Type
hi def link vimHelpgrep vimCommand
hi def link vimHiAttrib PreProc
hi def link vimHiBang vimBang
hi def link vimHiClear Type
@@ -1634,6 +1745,9 @@ if !exists("skip_vim_syntax_inits")
hi def link vimLetHereDocStop Special
hi def link vimLetRegister vimRegister
hi def link vimLineComment vimComment
hi def link vimMake vimCommand
hi def link vimMakeadd vimCommand
hi def link vimMakeBang vimBang
hi def link vimMapBang vimBang
hi def link vimMapLeader vimBracket
hi def link vimMapLeaderKey vimNotation
@@ -1701,6 +1815,9 @@ if !exists("skip_vim_syntax_inits")
hi def link vimSleep vimCommand
hi def link vimSleepArg Constant
hi def link vimSleepBang vimBang
hi def link vimSort vimCommand
hi def link vimSortBang vimBang
hi def link vimSortOptions Special
hi def link vimSpecFile Identifier
hi def link vimSpecFileMod vimSpecFile
hi def link vimSpecial Type
@@ -1768,6 +1885,10 @@ if !exists("skip_vim_syntax_inits")
hi def link vimUserFunc Normal
hi def link vimVar Normal
hi def link vimVarScope Identifier
hi def link vimVimgrep vimCommand
hi def link vimVimgrepadd vimCommand
hi def link vimVimgrepBang vimBang
hi def link vimVimgrepFlags Special
hi def link vimVimVar Identifier
hi def link vimVimVarName Identifier
hi def link vimWarn WarningMsg