The root of my question is about a difference between the way Vim processes multiple substitutions and they way other editors (Sublime, for example) do it.
I have this file:
thing1
thing2
thing3
thing4
thing5
And I want to perform this substitution:
:%s/\v^(.*)$\n?/'\1',/
In Sublime, performing a "Replace All" with that regex & replacement results in what I intended:
'thing1','thing2','thing3','thing4','thing5',
In Vim, though, I get this:
'thing1',thing2
'thing3',thing4
'thing5',
Adding a c
flag seems to explain this behavior:
Vim seems to be processing each substitution one at a time, which then causes the next line not to match, because it's no longer at the start of the line.
Removing ^
from the regex makes it work as expected, but is there another way? Is there any way to make Vim's substitution behave more like other editors' -- i.e. identifying all matches, then replacing them all regardless of how they're changed by earlier substitutions?