runtime(vim): Update base-syntax and generator, match all default highlight groups
- Match Conceal, ComplMatchIns, MsgArea, Terminal, and User[1-9] highlight groups. - Generate the vimGroup syntax group from runtime/syncolor.vim. - Match :SynColor and :SynLink as special user commands. fixes #17467 closes: #17556 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
a9b5e4af43
commit
c233c2e6a5
@ -1,7 +1,7 @@
|
||||
" Vim syntax file generator
|
||||
" Language: Vim script
|
||||
" Maintainer: Hirohito Higashi (h_east)
|
||||
" Last Change: 2025 Jun 24
|
||||
" Last Change: 2025 Jul 03
|
||||
|
||||
let s:keepcpo= &cpo
|
||||
set cpo&vim
|
||||
@ -517,6 +517,33 @@ function s:parse_vim_function(li)
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
" ------------------------------------------------------------------------------
|
||||
function s:parse_vim_group(li)
|
||||
try
|
||||
let file_name = $VIM_SRCDIR . '/../runtime/syntax/syncolor.vim'
|
||||
let item = {}
|
||||
|
||||
new
|
||||
exec 'read ' . file_name
|
||||
g!/^\s*Syn\%(Color\|Link\)/d
|
||||
%s/^\s*Syn\%(Color\|Link\)\s\+\(\w\+\).*/\1/
|
||||
|
||||
for group in getline(1, line('$'))->sort()->uniq()
|
||||
let item.name = group
|
||||
call add(a:li, copy(item))
|
||||
endfor
|
||||
|
||||
quit!
|
||||
|
||||
if empty(a:li)
|
||||
throw 'group is empty'
|
||||
endif
|
||||
catch /.*/
|
||||
call s:err_gen('')
|
||||
throw 'exit'
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
" ------------------------------------------------------------------------------
|
||||
function s:parse_vim_hlgroup(li)
|
||||
try
|
||||
@ -568,15 +595,19 @@ function s:parse_vim_hlgroup(li)
|
||||
|
||||
" The following highlight groups cannot be extracted from highlight.c
|
||||
" (TODO: extract from HIGHLIGHT_INIT ?)
|
||||
let item.name = 'LineNrAbove'
|
||||
let item.type = 'both'
|
||||
call add(a:li, copy(item))
|
||||
for group in ['ComplMatchIns', 'LineNrAbove', 'LineNrBelow', 'MsgArea', 'Terminal']
|
||||
let item.name = group
|
||||
let item.type = 'both'
|
||||
call add(a:li, copy(item))
|
||||
endfor
|
||||
|
||||
let item.name = 'LineNrBelow'
|
||||
let item.type = 'both'
|
||||
call add(a:li, copy(item))
|
||||
for n in range(1, 9)
|
||||
let item.name = 'User' .. n
|
||||
let item.type = 'both'
|
||||
call add(a:li, copy(item))
|
||||
endfor
|
||||
|
||||
" "Conceal" is an option and cannot be used as keyword, so remove it.
|
||||
" "Conceal" is a :syn option and cannot be used as keyword, so remove it.
|
||||
" (Separately specified as 'syn match' in vim.vim.base).
|
||||
call filter(a:li, {idx, val -> val.name !=# 'Conceal'})
|
||||
|
||||
@ -799,6 +830,11 @@ function s:update_syntax_vim_file(vim_info)
|
||||
let lnum = s:search_and_check('vimAutoEvent', base_fname, str_info)
|
||||
let lnum = s:append_syn_any(lnum, str_info, li)
|
||||
|
||||
" vimGroup
|
||||
let li = a:vim_info.group
|
||||
let lnum = s:search_and_check('vimGroup', base_fname, str_info)
|
||||
let lnum = s:append_syn_any(lnum, str_info, li)
|
||||
|
||||
" vimHLGroup
|
||||
let li = a:vim_info.hlgroup
|
||||
let lnum = s:search_and_check('vimHLGroup', base_fname, str_info)
|
||||
@ -1001,6 +1037,7 @@ try
|
||||
let s:vim_info.cmd = []
|
||||
let s:vim_info.event = []
|
||||
let s:vim_info.func = []
|
||||
let s:vim_info.group = []
|
||||
let s:vim_info.hlgroup = []
|
||||
let s:vim_info.compl_name = []
|
||||
let s:vim_info.addr_name = []
|
||||
@ -1013,6 +1050,7 @@ try
|
||||
silent call s:parse_vim_command(s:vim_info.cmd)
|
||||
silent call s:parse_vim_event(s:vim_info.event)
|
||||
silent call s:parse_vim_function(s:vim_info.func)
|
||||
silent call s:parse_vim_group(s:vim_info.group)
|
||||
silent call s:parse_vim_hlgroup(s:vim_info.hlgroup)
|
||||
silent call s:parse_vim_complete_name(s:vim_info.compl_name)
|
||||
silent call s:parse_vim_addr_name(s:vim_info.addr_name)
|
||||
|
||||
@ -88,7 +88,7 @@ syn keyword vimAutoEvent contained User skipwhite nextgroup=vimUserAutoEvent
|
||||
syn match vimUserAutoEvent contained "\<\h\w*\>" skipwhite nextgroup=vimUserAutoEventSep,vimAutocmdMod,vimAutocmdBlock
|
||||
|
||||
" 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
|
||||
" GEN_SYN_VIM: vimGroup, START_STR='syn keyword vimGroup contained', END_STR=''
|
||||
|
||||
" Default highlighting groups {{{2
|
||||
" GEN_SYN_VIM: vimHLGroup, START_STR='syn keyword vimHLGroup contained', END_STR=''
|
||||
@ -230,7 +230,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,vimDelcommand,vimDelFunction,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimExMark,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,vimThrow,vimUniq,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,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,vimDelcommand,vimDelFunction,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimExMark,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,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
|
||||
@ -1423,7 +1423,13 @@ syn match vimSynMenuPath contained ".*\ze:" nextgroup=vimSynMenuColon contains=v
|
||||
syn match vimSynMenuColon contained ":" nextgroup=vimSynMenuName
|
||||
syn match vimSynMenuName contained "\w\+"
|
||||
|
||||
syn cluster vimExUserCmdList contains=vimCompilerSet,vimSynMenu
|
||||
" runtime/syntax/syncolor.vim
|
||||
syn match vimSynColor "\<SynColor\>" skipwhite nextgroup=vimSynColorGroup
|
||||
syn match vimSynColorGroup contained "\<\h\w*\>" skipwhite nextgroup=vimHiKeyList contains=vimGroup
|
||||
syn match vimSynLink "\<SynLink\>" skipwhite nextgroup=vimSynLinkGroup
|
||||
syn match vimSynLinkGroup contained "\<\h\w*\>" skipwhite nextgroup=vimGroup contains=vimGroup
|
||||
|
||||
syn cluster vimExUserCmdList contains=vimCompilerSet,vimSynColor,vimSynLink,vimSynMenu
|
||||
|
||||
" Errors And Warnings: {{{2
|
||||
" ====================
|
||||
@ -1671,8 +1677,9 @@ endif
|
||||
syn match vimHighlight "\<hi\%[ghlight]\>" skipwhite nextgroup=vimHiBang,@vimHighlightCluster
|
||||
syn match vimHiBang contained "\a\@1<=!" skipwhite nextgroup=@vimHighlightCluster
|
||||
|
||||
syn match vimHiGroup contained "\i\+"
|
||||
syn case ignore
|
||||
" Conceal is a generated low-priority match
|
||||
syn match vimHiGroup contained "\%(\<Conceal\>\)\@!\i\+"
|
||||
syn keyword vimHiNone contained NONE
|
||||
syn keyword vimHiAttrib contained none bold inverse italic nocombine reverse standout strikethrough underline undercurl underdashed underdotted underdouble
|
||||
syn keyword vimFgBgAttrib contained none bg background fg foreground
|
||||
@ -2499,6 +2506,8 @@ if !exists("skip_vim_syntax_inits")
|
||||
hi def link vim9Vim9Script vimCommand
|
||||
|
||||
hi def link vimCompilerSet vimCommand
|
||||
hi def link vimSynColor vimCommand
|
||||
hi def link vimSynLink vimCommand
|
||||
hi def link vimSynMenu vimCommand
|
||||
hi def link vimSynMenuPath vimMenuName
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user