Wednesday, February 3, 2010

Re: Recording a sequence which doesn't terminate on a search and replace failure

On 3 February 2010 10:12, James Kanze <james.kanze@gmail.com> wrote:
> I was wondering if there was a simple way to define a recorded
> sequence in vim which doesn't terminate if a :s command doesn't
> find any matches.  Basically, I'm converting blocks of C++ code
> to C++ strings, with things like
>        :'a,'bs/"/\\:/g
> .  Except that not all of the blocks contain strings, so
> sometimes, this search and replace will fail.  I'd like the
> recorded sequence to continue in such cases.

Have you tried the 'e' flag to substitute?

:'a,'bs/"/\\:/ge

:help :s_flags

For information, also see

:help :silent

In particular :silent!


Al

--
http://sites.google.com/site/abudden

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: