Monday, January 24, 2011

Re: bufdo and macro

On 24/01/11 9:44 PM, Kim Schulz wrote:
> Hi,
> I have a problem with a simple macro I record and then want to play back on all
> buffers (62 of them) using bufdo. Vim keeps throwing the error E169: Command too
> recursive
>
> The macro is quite simple:
> qa
> :%s/expectedMessage = &(((.*) *)(.*);/CsrMemCpy(expectedMessage, &((1 *) 2,
> sizeof(1));/

This pattern looks a bit funny to me; it could be the cause of the
problem, though it doesn't seem all that likely, to be honest. But are
you sure it is doing what you want? It looks like you are trying to use
submatches \1 \2 \3 in your substitute text, but there are no \ where I
would expect to see them, and no subpatterns marked with \( and \) in
the pattern, nor any \v very-magic directive. There is also a & in the
substitute text, which will stand for the whole matched pattern; maybe
it is continually replacing the pattern with itself and finding it
again, and recursing that way. It seems unlikely you would have messed
this up, though. But perhaps some setting is different in one/some of
the other buffers that it is making it work differently?

If the pattern is working right, though, this seems strange.

> f,
> insert newline
> f,
> insert newline
> k
> k
> =}
> :w!
> q
>
> I then use
> :bufdo norm @a
> ...which then gives me the before mentioned error a lot of times. If I run the
> macro on a single buffer I do not have this problem.
>
> Any suggestions as to why I get the error? how do I fix it?

Also, all your buffers are detected as having the same filetype, aren't
they? So there shouldn't be any different mappings for some of the
buffers? Or does this rely somehow on some setting that a syntax plugin
sets, and so is breaking because syntax autocommands are skipped by
:bufdo?

I'm just throwing ideas out there...none of them seems all that likely
to be the solution, to be honest....

Good luck!

Ben.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: