Wim R. Crols wrote:
Hi,
How can I apply a macro on a set of selected lines? I have a simple
mapping under <F4> (aligment of '=' on the same column, but it's not
really important)
:map <F4> 0f=60i <Esc>D60<Bar>p
and I want to execute it for every line in a Visual Line selection. I
tried this
:'<,'>normal <F4>
But there was no effect. Is there an alternative, please?
Thank you,
Wim
Possibility 1:
:'<,'>exe "normal \<F4>"
Possibility 2:
:'<,'>normal (hit Ctrl-V)(hit F4)
where (hit Ctrl-V) means "hit Ctrl-V unless your Ctrl-V is remapped to
paste from the clipboard, in which case you should hit Ctrl-Q instead".
Possibility 3: Find out what the macro is doing and program it in a
command (without -range) or function. Then run the command or call the
function with :'<,'>
0 go to 1st character in line
f= to next = sign (the first one not in column 1)
60i<Space><Esc> insert sixty spaces before the cursor
D delete until end of line
60<Bar> go to column 60
p put unnamed register after cursor
Best regards,
Tony.