From 7db83d47b2bf88bb8d1c5c95407f66cf7807003c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 29 Jan 2024 06:33:43 +0800 Subject: [PATCH] vim-patch:21ce159e0561 runtime(vim): Update syntax and ftplugin files (vim/vim#13924) Improve matching of line-continuations and interspersed comments. These are now also matched in multiline syntax command patterns, dictionary literals, and parenthesised expressions and argument lists. https://github.com/vim/vim/commit/21ce159e05615fd139c564b734a4bffc9f3fdc4b Co-authored-by: dkearns --- runtime/ftplugin/vim.vim | 2 +- runtime/syntax/vim.vim | 48 +++++++++++++++++++++------------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim index 8abe337f9f..f5dae0f94e 100644 --- a/runtime/ftplugin/vim.vim +++ b/runtime/ftplugin/vim.vim @@ -58,7 +58,7 @@ endif " Set 'comments' to format dashed lists in comments, both in Vim9 and legacy " script. -setlocal com=sO:#\ -,mO:#\ \ ,eO:##,:#,sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" +setlocal com=sO:#\ -,mO:#\ \ ,eO:##,:#\\\ ,:#,sO:\"\ -,mO:\"\ \ ,eO:\"\",:\"\\\ ,:\" " Format comments to be up to 78 characters long diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 5fb47bdcef..327790fe92 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -204,7 +204,7 @@ syn keyword vimAugroupKey contained aug[roup] " Operators: {{{2 " ========= -syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimType,vimRegister,vimContinue,vim9Comment,vimVar +syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimType,vimRegister,@vimContinue,vim9Comment,vimVar syn match vimOper "||\|&&\|[-+*/%.!]" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "\%#=1\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\|!\~#\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "\(\" skipwhite nextgroup=vimString,vimSpecFile @@ -476,23 +476,23 @@ syn match vimNormCmds contained ".*$" " Syntax: {{{2 "======= -syn match vimGroupList contained "@\=[^[:space:],]\+" nextgroup=vimGroupListComma skipwhite skipnl -syn match vimGroupListContinue contained "\\" nextgroup=vimGroupList skipwhite -syn match vimGroupListComma contained "," nextgroup=vimGroupList,vimGroupListContinue skipwhite skipnl -syn keyword vimGroupSpecial contained ALL ALLBUT CONTAINED TOP +syn match vimGroupList contained "[^[:space:],]\+\%(\s*,\s*[^[:space:],]\+\)*" contains=vimGroupSpecial +syn region vimGroupList contained start=/^\s*["#]\\ \|^\s*\\\|[^[:space:],]\+\s*,/ skip=/\s*\n\s*\\\|\s*\n\s*["#]\\ \|^\s*\\\|^\s*["#]\\ / end=/[^[:space:],]\s*$\|[^[:space:],]\ze\s\+\w/ contains=@vimContinue,vimGroupSpecial +syn keyword vimGroupSpecial contained ALL ALLBUT CONTAINED TOP + if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimsynerror") syn match vimSynError contained "\i\+" syn match vimSynError contained "\i\+=" nextgroup=vimGroupList endif -syn match vimSynContains contained "\