runtime(vim): Update base-syntax, improve :menu{,translate} highlighting (#14162)
Improve :menu and :menutranslate highlighting.
- Match args to :menutranslation and :popup.
- Only highlight special notation in {rhs} of :menu, like :map.
- Allow line continuations in {rhs} of :menu and between {english} and
{mylang} of :menutranslation, matching common usage.
- Bug fixes.
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@ -2,8 +2,8 @@
|
||||
" Language: Vim script
|
||||
" Maintainer: Hirohito Higashi (h_east)
|
||||
" URL: https://github.com/vim-jp/syntax-vim-ex
|
||||
" Last Change: 2024 Mar 02
|
||||
" Version: 2.0.4
|
||||
" Last Change: 2024 Mar 09
|
||||
" Version: 2.0.5
|
||||
|
||||
let s:keepcpo= &cpo
|
||||
set cpo&vim
|
||||
@ -271,7 +271,7 @@ function! s:get_vim_command_type(cmd_name)
|
||||
" 6: mapclear
|
||||
" 7: unmap
|
||||
" 99: (Exclude registration of "syn keyword")
|
||||
let menu_prefix = '^\%([acinosvx]\?\|tl\)'
|
||||
let menu_prefix = '^\%([acinostvx]\?\|tl\)'
|
||||
let map_prefix = '^[acilnostvx]\?'
|
||||
let echo_suffix = '\%(n\|hl\|msg\|window\|err\|console\|\)$'
|
||||
let exclude_list = [
|
||||
@ -284,7 +284,7 @@ function! s:get_vim_command_type(cmd_name)
|
||||
\ 'behave', 'augroup', 'normal', 'syntax',
|
||||
\ 'append', 'insert',
|
||||
\ 'Next', 'Print', 'X',
|
||||
\ 'new',
|
||||
\ 'new', 'popup',
|
||||
\ ]
|
||||
" Required for original behavior
|
||||
" \ 'global', 'vglobal'
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
|
||||
" Doug Kearns <dougkearns@gmail.com>
|
||||
" URL: https://github.com/vim-jp/syntax-vim-ex
|
||||
" Last Change: 2024 Mar 04
|
||||
" Last Change: 2024 Mar 09
|
||||
" Former Maintainer: Charles E. Campbell
|
||||
" Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM
|
||||
" Base File Version: 9.0-25
|
||||
@ -166,7 +166,7 @@ syn match vimNumber '0[0-7]\+' skipwhite nextgroup=vimGlobal,vimSubst1,v
|
||||
syn match vimNumber '0[bB][01]\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment
|
||||
|
||||
" All vimCommands are contained by vimIsCommand. {{{2
|
||||
syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimEcho,vimEchoHL,vimExecute,vimIsCommand,vimExtCmd,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd
|
||||
syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimEcho,vimEchoHL,vimExecute,vimIsCommand,vimExtCmd,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate
|
||||
syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1
|
||||
syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand
|
||||
syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>"
|
||||
@ -478,15 +478,27 @@ syn case match
|
||||
|
||||
" Menus: {{{2
|
||||
" =====
|
||||
syn cluster vimMenuList contains=vimMenuBang,vimMenuPriority,vimMenuName,vimMenuMod
|
||||
" GEN_SYN_VIM: vimCommand menu, START_STR='syn keyword vimCommand', END_STR='skipwhite nextgroup=@vimMenuList'
|
||||
syn match vimMenuName "[^ \t\\<]\+" contained nextgroup=vimMenuNameMore,vimMenuMap
|
||||
syn match vimMenuPriority "\d\+\(\.\d\+\)*" contained skipwhite nextgroup=vimMenuName
|
||||
syn match vimMenuNameMore "\c\\\s\|<tab>\|\\\." contained nextgroup=vimMenuName,vimMenuNameMore contains=vimNotation
|
||||
syn match vimMenuMod contained "\c<\(script\|silent\)\+>" skipwhite contains=vimMapModKey,vimMapModErr nextgroup=@vimMenuList
|
||||
syn match vimMenuMap "\s" contained skipwhite nextgroup=vimMenuRhs
|
||||
syn match vimMenuRhs ".*$" contained contains=vimString,vimComment,vim9Comment,vimIsCommand
|
||||
syn match vimMenuBang "!" contained skipwhite nextgroup=@vimMenuList
|
||||
" NOTE: tail comments disallowed
|
||||
" GEN_SYN_VIM: vimCommand menu, START_STR='syn keyword vimMenu', END_STR='skipwhite nextgroup=vimMenuBang,vimMenuMod,vimMenuName,vimMenuPriority,vimMenuStatus'
|
||||
syn keyword vimMenu popu[p] skipwhite nextgroup=vimMenuBang,vimMenuName
|
||||
syn region vimMenuRhs contained contains=@vimContinue,vimNotation start="|\@!\S" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + end="$" matchgroup=vimSep end="|"
|
||||
syn region vimMenuRhsContinue contained contains=@vimContinue,vimNotation start=+^\s*\%(\\\|"\\ \)+ skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + end="$" matchgroup=vimSep end="|"
|
||||
syn match vimMenuName "\%(\\\s\|\S\)\+" contained contains=vimMenuNotation,vimNotation skipwhite nextgroup=vimCmdSep,vimMenuRhs
|
||||
syn match vimMenuName "\%(\\\s\|\S\)\+\ze\s*$" contained contains=vimMenuNotation,vimNotation skipwhite skipnl nextgroup=vimCmdSep,vimMenuRhsContinue
|
||||
syn match vimMenuNotation "&\a\|&&\|\\\s\|\\\." contained
|
||||
syn match vimMenuPriority "\<\d\+\%(\.\d\+\)*\>" contained skipwhite nextgroup=vimMenuName
|
||||
syn match vimMenuMod "\c<\%(script\|silent\|special\)>" contained skipwhite nextgroup=vimMenuName,vimMenuPriority,vimMenuMod contains=vimMapModKey,vimMapModErr
|
||||
syn keyword vimMenuStatus enable disable nextgroup=vimMenuName skipwhite
|
||||
syn match vimMenuBang "\a\@1<=!" contained skipwhite nextgroup=vimMenuName,vimMenuMod
|
||||
|
||||
syn region vimMenutranslate
|
||||
\ matchgroup=vimCommand start="\<menut\%[ranslate]\>"
|
||||
\ skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ +
|
||||
\ end="$" matchgroup=vimCmdSep end="|" matchgroup=vimMenuClear end="\<clear\ze\s*\%(["#|]\|$\)"
|
||||
\ contains=@vimContinue,vimMenutranslateName keepend transparent
|
||||
" oneline is sufficient to match the current formatting in runtime/lang/*.vim
|
||||
syn match vimMenutranslateName "\%(\\\s\|\S\)\+" contained contains=vimMenuNotation,vimNotation
|
||||
syn match vimMenutranslateComment +".*+ contained containedin=vimMenutranslate
|
||||
|
||||
" Angle-Bracket Notation: (tnx to Michael Geddes) {{{2
|
||||
" ======================
|
||||
@ -901,6 +913,7 @@ if exists("g:vimsyn_minlines")
|
||||
endif
|
||||
exe "syn sync maxlines=".s:vimsyn_maxlines
|
||||
syn sync linecont "^\s\+\\"
|
||||
syn sync linebreaks=1
|
||||
syn sync match vimAugroupSyncA groupthere NONE "\<aug\%[roup]\>\s\+[eE][nN][dD]"
|
||||
|
||||
" ====================
|
||||
@ -1016,9 +1029,14 @@ if !exists("skip_vim_syntax_inits")
|
||||
hi def link vimMark Number
|
||||
hi def link vimMarkNumber vimNumber
|
||||
hi def link vimMenuBang vimBang
|
||||
hi def link vimMenuClear Special
|
||||
hi def link vimMenuMod vimMapMod
|
||||
hi def link vimMenuNameMore vimMenuName
|
||||
hi def link vimMenuName PreProc
|
||||
hi def link vimMenu vimCommand
|
||||
hi def link vimMenuNotation vimNotation
|
||||
hi def link vimMenuPriority Number
|
||||
hi def link vimMenuStatus Special
|
||||
hi def link vimMenutranslateComment vimComment
|
||||
hi def link vimMtchComment vimComment
|
||||
hi def link vimNorm vimCommand
|
||||
hi def link vimNotation Special
|
||||
|
||||
Reference in New Issue
Block a user