summaryrefslogtreecommitdiffstats
path: root/runtime/syntax/generator/vim.vim.base
diff options
context:
space:
mode:
authordkearns <dougkearns@gmail.com>2024-03-10 03:43:28 +1100
committerGitHub <noreply@github.com>2024-03-09 17:43:28 +0100
commit62b26040eb4b6752be2c46852e8986083737a1bb (patch)
tree831dd89aac09c770263e052faf6cfae31dfae045 /runtime/syntax/generator/vim.vim.base
parent35b867b685cedbcbba9d44695077ecc9a6995f4c (diff)
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>
Diffstat (limited to 'runtime/syntax/generator/vim.vim.base')
-rw-r--r--runtime/syntax/generator/vim.vim.base42
1 files changed, 30 insertions, 12 deletions
diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base
index f26a94a19c..5fc0d089e2 100644
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -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