Commit: runtime(vim): Update base-syntax, improve :autocmd highlighting

2 views
Skip to first unread message

Christian Brabandt

unread,
Apr 22, 2025, 2:00:20 PM4/22/25
to vim...@googlegroups.com
runtime(vim): Update base-syntax, improve :autocmd highlighting

Commit: https://github.com/vim/vim/commit/fa3b1043c6ac38df5e58f7444f478e1ddd4000a6
Author: Doug Kearns <dougk...@gmail.com>
Date: Tue Apr 22 19:48:13 2025 +0200

runtime(vim): Update base-syntax, improve :autocmd highlighting

- Match full :autocmd, :doautocmd and :doautoall commands.
- Add filename pattern (wildcard) highlighting.

Signed-off-by: Doug Kearns <dougk...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/syntax/generator/gen_syntax_vim.vim b/runtime/syntax/generator/gen_syntax_vim.vim
index d2bfc5c67..e016deaf8 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 Apr 10
+" Last Change: 2025 Apr 23

let s:keepcpo= &cpo
set cpo&vim
@@ -257,7 +257,6 @@ function s:get_vim_command_type(cmd_name)
abstract
append
augroup
- augroup
autocmd
behave
call
@@ -402,6 +401,10 @@ function s:parse_vim_event(li)
call add(a:li, copy(item))
endfor

+ " "User" requires a user defined argument event.
+ " (Separately specified in vim.vim.base).
+ call filter(a:li, {idx, val -> val.name !=# 'User'})
+
quit!

if empty(a:li)
diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base
index 2dab30760..21fcf37c8 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 <dougk...@gmail.com>
-" Last Change: 2025 Apr 10
+" Last Change: 2025 Apr 23
" Former Maintainer: Charles E. Campbell

" DO NOT CHANGE DIRECTLY.
@@ -78,7 +78,10 @@ syn match vimOptionVarName contained "t_k;"

" AutoCmd Events {{{2
syn case ignore
-" GEN_SYN_VIM: vimAutoEvent, START_STR='syn keyword vimAutoEvent contained', END_STR=''
+" GEN_SYN_VIM: vimAutoEvent, START_STR='syn keyword vimAutoEvent contained', END_STR='skipwhite nextgroup=vimAutoEventSep,@vimAutocmdPattern'
+
+syn keyword vimAutoEvent contained User skipwhite nextgroup=vimUserAutoEvent
+syn match vimUserAutoEvent contained "\<\h\w*\>" skipwhite nextgroup=vimAutoEventSep,@vimAutocmdPattern

" Highlight commonly used Groupnames {{{2
syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo
@@ -230,7 +233,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,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 vimCmdList contains=vimAbb,vimAddress,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimConst,vimDoautocmd,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
@@ -319,21 +322,32 @@ syn keyword vimFTOption contained detect indent off on plugin
" Augroup : vimAugroupError removed because long augroups caused sync'ing problems. {{{2
" ======= : Trade-off: Increasing synclines with slower editing vs augroup END error checking.
syn cluster vimAugroupList contains=@vimCmdList,vimFilter,vimFunc,vimLineComment,vimSpecFile,vimOper,vimNumber,vimOperParen,@vimComment,vimString,vimSubst,vimRegister,vimCmplxRepeat,vimNotation,vimCtrlChar,vimContinue
-syn match vimAugroup "\<aug\%[roup]\>" contains=vimAugroupKey,vimAugroupBang skipwhite nextgroup=vimAugroupBang,vimAutoCmdGroup
-if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'a'
- syn region vimAugroup fold start="\<aug\%[roup]\>\ze\s\+\%([eE][nN][dD]\)\@!\S\+" matchgroup=vimAugroupKey end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList,vimAugroupkey skipwhite nextgroup=vimAugroupEnd
-else
- syn region vimAugroup start="\<aug\%[roup]\>\ze\s\+\%([eE][nN][dD]\)\@!\S\+" matchgroup=vimAugroupKey end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList,vimAugroupkey skipwhite nextgroup=vimAugroupEnd
-endif
+
+" define
+VimFolda syn region vimAugroup
+ \ start="\<aug\%[roup]\>\ze\s\+\%([eE][nN][dD]\)\@!\S\+"
+ \ matchgroup=vimAugroupKey
+ \ end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>"
+ \ skipwhite nextgroup=vimAugroupEnd
+ \ contains=vimAutocmd,@vimAugroupList,vimAugroupkey
if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noaugrouperror")
- syn match vimAugroupError "\<aug\%[roup]\>\s\+[eE][nN][dD]\>"
+ syn match vimAugroupError "\<aug\%[roup]\>\s\+[eE][nN][dD]\>"
endif

-syn match vimAutoCmdGroup contained "\S\+"
-syn match vimAugroupEnd contained "
Reply all
Reply to author
Forward
0 new messages