view runtime/syntax/testdir/input/vim_ex_substitute.vim @ 34433:f7438681c79b

runtime(vim): Update syntax file, improve :substitute matching (#14093) Commit: https://github.com/vim/vim/commit/2c51e15b66a4be9b5134c495ef546479aaa89ce9 Author: dkearns <dougkearns@gmail.com> Date: Tue Feb 27 07:10:18 2024 +1100 runtime(vim): Update syntax file, improve :substitute matching (https://github.com/vim/vim/issues/14093) - Differentiate between :substitute and substitute(), fixes https://github.com/vim/vim/issues/13883. - Match all allowed :substitute delimiters. - Remove leading context from :substitute matches. Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Mon, 26 Feb 2024 21:15:03 +0100
parents
children f9613d63108f
line wrap: on
line source

substitute/foo/bar/&
substitute/foo/bar/cegiInp#lr

snomagic/foo/bar/&
snomagic/foo/bar/cegiInp#lr

smagic/foo/bar/&
smagic/foo/bar/cegiInp#lr

:substitute/foo/bar/&
:substitute/foo/bar/cegiInp#lr

:snomagic/foo/bar/&
:snomagic/foo/bar/cegiInp#lr

:smagic/foo/bar/&
:smagic/foo/bar/cegiInp#lr

call Foo() | substitute/foo/bar/&
call Foo() | substitute/foo/bar/cegiInp#lr

call Foo() | snomagic/foo/bar/&
call Foo() | snomagic/foo/bar/cegiInp#lr

call Foo() | smagic/foo/bar/&
call Foo() | smagic/foo/bar/cegiInp#lr

let foo = str->substitute(str, pat, sub, flags)

function Foo()
  substitute/foo/bar/
  let bar = str->substitute(str, pat, sub, flags)
endfunction

def Foo()
  substitute/foo/bar/
  let bar = str->substitute(str, pat, sub, flags)
enddef

" various delimiters

s!/!//! " comment
" s"/"//" " comment (works but disallowed)
s#/#//# " comment
s$/$//$ " comment
s%/%//% " comment
s&/&//& " comment
s'/'//' " comment
" FIXME - matches vimUserFunc
" s(/(//( " comment
s)/)//) " comment
s*/*//* " comment
s+/+//+ " comment
s,/,//, " comment
s-/-//- " comment
s././/. " comment
s/X/XX/ " comment
s:/://: " comment
s;/;//; " comment
s</<//< " comment
s=/=//= " comment
s>/>//> " comment
s?/?//? " comment
s@/@//@ " comment
s[/[//[ " comment
" s\/\//\ " comment (disallowed)
s]/]//] " comment
s^/^//^ " comment
s_/_//_ " comment
s`/`//` " comment
s{/{//{ " comment
" s|/|//| " comment (disallowed)
s}/}//} " comment
s~/~//~ " comment


" Issue #13883

str[s]
str(s)

def Test()
  str[s]
  str(s)
enddef