runtime(vim): Update base-syntax, allow whitespace before :substitute pattern
Allow whitespace between the :substitute command and its pattern
argument. Although unusual, it is supported and there are examples in
the wild.
Match Vi compatible :substitute commands like :s\/{string}/. See :help
E1270.
fixes: #14920
closes: #14923
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
dca57fb542
commit
92f4e91590
@ -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 Apr 13
|
||||
" Last Change: 2024 Jun 05
|
||||
" Former Maintainer: Charles E. Campbell
|
||||
|
||||
" DO NOT CHANGE DIRECTLY.
|
||||
@ -438,12 +438,10 @@ syn match vimStringInterpolationBrace contained "}}"
|
||||
syn cluster vimSubstList contains=vimPatSep,vimPatRegion,vimPatSepErr,vimSubstTwoBS,vimSubstRange,vimNotation
|
||||
syn cluster vimSubstRepList contains=vimSubstSubstr,vimSubstTwoBS,vimNotation
|
||||
syn cluster vimSubstList add=vimCollection
|
||||
syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)\>[\"#|]\@!" nextgroup=vimSubstPat
|
||||
syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)_\@=" nextgroup=vimSubstPat
|
||||
syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat
|
||||
syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\>[\"#|]\@!" nextgroup=vimSubstPat
|
||||
syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)_\@=" nextgroup=vimSubstPat
|
||||
syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat
|
||||
syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)\>" skipwhite nextgroup=vimSubstPat
|
||||
syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)[_#]\@=" skipwhite nextgroup=vimSubstPat
|
||||
syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\>" skipwhite nextgroup=vimSubstPat
|
||||
syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)[_#]\@=" skipwhite nextgroup=vimSubstPat
|
||||
" TODO: Vim9 illegal separators for abbreviated :s form are [-.:], :su\%[...] required
|
||||
" : # is allowed but "not recommended" (see :h pattern-delimiter)
|
||||
syn region vimSubstPat contained matchgroup=vimSubstDelim start="\z([!#$%&'()*+,-./:;<=>?@[\]^_`{}~]\)"rs=s+1 skip="\\\\\|\\\z1" end="\z1"re=e-1,me=e-1 contains=@vimSubstList nextgroup=vimSubstRep4 oneline
|
||||
@ -456,6 +454,10 @@ syn match vimSubstTwoBS contained "\\\\"
|
||||
syn match vimSubstFlagErr contained "[^< \t\r|]\+" contains=vimSubstFlags
|
||||
syn match vimSubstFlags contained "[&cegiIlnpr#]\+"
|
||||
|
||||
" Vi compatibility
|
||||
syn match vimSubstDelim contained "\\"
|
||||
syn match vimSubstPat contained "\\\ze[/?&]" contains=vimSubstDelim nextgroup=vimSubstRep4
|
||||
|
||||
" 'String': {{{2
|
||||
syn match vimString "[^(,]'[^']\{-}\zs'"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user