I wonder if my plugin:
SrchRplcHiGrp.vim : Search and/or replace based on a syntax highlight
group http://www.vim.org/scripts/script.php?script_id=848
Could be used in this case.
If not, I would be willing to look into how it doesn't meet your needs
and make some changes.
I think it should do what you want though.
Dave
David Fishburn came up with a plugin to facilitate syntax-based replaces:
SrchRplcHiGrp.vim - Search and Replace based on a highlight group
http://www.vim.org/script.php?script_id=848
Regards,
Chip Campbell
IIUC, technically the "pattern" here is just /foo/ -- or, rather, the
string 'foo' but there are many places where patterns are bounded by
slashes.
Everything between /foo/ and /g is the replacement string, or in this
case, '\=' plus the replace-expression.
I would call the whole line a substitute, or to be more precise, 'a
":substitute" command'. Calling it a "pattern" is in this case an abuse
of language, which may perhaps be condoned in informal text since the
context is clear.
(And, yes, I'm a retired teacher, and I can be quite a pedant when it
suits me.)
Best regards,
Tony.
--
All of the true things I am about to tell you are shameless lies.
-- The Book of Bokonon / Kurt Vonnegut Jr.
--
Andy