Though untested, my first thought would be something like
:'<,'>g/^/norm @z
(assuming your macro was in register "z")
Which in theory could be extended to execute a macro on lines
matching a regexp:
:g/regexp/norm @z
If it doesn't work, I'm sure others out there have good
suggestions (that they've tested ;-) too.
-tim
Tim Chase wrote:
>
>> I can record keystrokes to a register
>> I can playback the register
>> I can playback the register count times
>> Is there a way to playback the register by range?
>
> Though untested, my first thought would be something like
>
> :'<,'>g/^/norm @z
>
> (assuming your macro was in register "z")
no need to use :global,
:'<,'>normal @z
works, too.
> Which in theory could be extended to execute a macro on lines
> matching a regexp:
>
> :g/regexp/norm @z
>
>
> If it doesn't work, I'm sure others out there have good
> suggestions (that they've tested ;-) too.
Just tested. ;.)
Regards,
Jürgen
--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)
I've had just enough trouble forgetting which Ex commands (mostly
the ones I don't use regularly) accept a range and which default
to the first or last line of that range. So I tend to toss in
the extra "g/^/" guard to make sure the operation is happening on
each line rather than guess wrong and have to undo+rerun the
command. ":exec" and ":put" are the big ones I guess that
regularly get me (or rather "got" me...before I started using the
:g form). ":norm" lumps in my head with ":exec", but on reading
the docs (and Jurgen's evidence) ":norm" takes a range, and
":exec" balks at it.
-tim