runtime(vim): Update base-syntax and generator, generate command modifiers
Generate Ex command modifiers from the modifier table in src/ex_docmd.c closes: #17564 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
4ade668fb6
commit
a9b5e4af43
@ -234,16 +234,51 @@ function s:parse_vim_command(cmd)
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
function s:get_cmd_modifiers()
|
||||
try
|
||||
let file_name = $VIM_SRCDIR .. '/ex_docmd.c'
|
||||
|
||||
new
|
||||
exec 'read ' .. file_name
|
||||
norm! gg
|
||||
exec ':/^static cmdmod_info_T cmdmod_info_tab\[] = {/+1;/^};/-1yank'
|
||||
%delete _
|
||||
|
||||
put
|
||||
1delete _
|
||||
|
||||
let modifiers = []
|
||||
let list = []
|
||||
for line in getline(1, line('$'))
|
||||
let list = matchlist(line, '^\s*{"\(\w\+\)".*')
|
||||
call add(modifiers, copy(list[1]))
|
||||
endfor
|
||||
|
||||
quit!
|
||||
|
||||
if empty(modifiers)
|
||||
throw 'cmd modifiers list is empty'
|
||||
endif
|
||||
|
||||
return modifiers
|
||||
|
||||
catch /.*/
|
||||
call s:err_gen('')
|
||||
throw 'exit'
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function s:get_vim_command_type(cmd_name)
|
||||
" Return value:
|
||||
" 0: normal
|
||||
" 1: (Reserved)
|
||||
" 2: abbrev (without un)
|
||||
" 2: abbrev
|
||||
" 3: menu
|
||||
" 4: map
|
||||
" 5: mapclear
|
||||
" 6: unmap
|
||||
" 7: abclear
|
||||
" 8: modifiers
|
||||
" 99: (Exclude registration of "syn keyword")
|
||||
let ab_prefix = '^[ci]\?'
|
||||
let menu_prefix = '^\%([acinostvx]\?\|tl\)'
|
||||
@ -362,7 +397,6 @@ function s:get_vim_command_type(cmd_name)
|
||||
EOL
|
||||
" Required for original behavior
|
||||
" \ 'global', 'vglobal'
|
||||
|
||||
if index(exclude_list, a:cmd_name) != -1
|
||||
let ret = 99
|
||||
elseif a:cmd_name =~# '^\%(\%(un\)\?abbreviate\|noreabbrev\|\l\%(nore\|un\)\?abbrev\)$'
|
||||
@ -377,6 +411,8 @@ function s:get_vim_command_type(cmd_name)
|
||||
let ret = 5
|
||||
elseif a:cmd_name =~# map_prefix . 'unmap$'
|
||||
let ret = 6
|
||||
elseif index(s:get_cmd_modifiers(), a:cmd_name) != -1
|
||||
let ret = 8
|
||||
else
|
||||
let ret = 0
|
||||
endif
|
||||
@ -805,6 +841,9 @@ function s:update_syntax_vim_file(vim_info)
|
||||
" vimCommand - menu
|
||||
let lnum = s:search_and_check(kword . ' menu', base_fname, str_info)
|
||||
let lnum = s:append_syn_vimcmd(lnum, str_info, li, 3)
|
||||
" 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)
|
||||
|
||||
update
|
||||
quit!
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
" Language: Vim script
|
||||
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
|
||||
" Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2025 Jun 30
|
||||
" Last Change: 2025 Jul 03
|
||||
" Former Maintainer: Charles E. Campbell
|
||||
|
||||
" DO NOT CHANGE DIRECTLY.
|
||||
@ -34,6 +34,10 @@ 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'
|
||||
|
||||
" GEN_SYN_VIM: vimCommand modifier, START_STR='syn keyword vimCommandModifier', END_STR='skipwhite nextgroup=vimCommandModifierBang,@vimCmdList'
|
||||
" :filter is handled specially elsewhere
|
||||
syn match vimCommandModifierBang contained "\a\@1<=!" skipwhite nextgroup=@vimCmdList
|
||||
|
||||
" Lower priority for _new_ to distinguish constructors from the command.
|
||||
syn match vimCommand contained "\<new\>(\@!"
|
||||
syn match vimCommand contained "\<z[-+^.=]\=\>"
|
||||
@ -226,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,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,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
|
||||
@ -1242,7 +1246,6 @@ syn region vimExecute
|
||||
" 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]"
|
||||
@ -1257,6 +1260,7 @@ syn region vimExFilterPattern contained
|
||||
\ skipwhite nextgroup=@vimCmdList
|
||||
\ contains=@vimSubstList
|
||||
\ oneline
|
||||
syn match vimExFilterBang contained "\a\@1<=!" skipwhite nextgroup=vimExFilterPattern
|
||||
|
||||
" Grep and Make: {{{2
|
||||
" =============
|
||||
@ -2163,6 +2167,8 @@ if !exists("skip_vim_syntax_inits")
|
||||
hi def link vimCatch vimCommand
|
||||
hi def link vimCmplxRepeat SpecialChar
|
||||
hi def link vimCommand Statement
|
||||
hi def link vimCommandModifier vimCommand
|
||||
hi def link vimCommandModifierBang vimBang
|
||||
hi def link vimComment Comment
|
||||
hi def link vimCommentError vimError
|
||||
hi def link vimCommentString vimString
|
||||
@ -2197,7 +2203,7 @@ if !exists("skip_vim_syntax_inits")
|
||||
hi def link vimError Error
|
||||
hi def link vimEscape Special
|
||||
hi def link vimExFilter vimCommand
|
||||
hi def link vimExFilterBang vimCommand
|
||||
hi def link vimExFilterBang vimBang
|
||||
hi def link vimExMark vimCommand
|
||||
hi def link vimFBVar vimVar
|
||||
hi def link vimFgBgAttrib vimHiAttrib
|
||||
|
||||
Reference in New Issue
Block a user