The contents of register w are xx. When I try to run the following command:
:for i in range(1,10) | if i > 5 | @w | endif | endfor
It throws an error saying that E492: Not an editor command xx.
How do I execute the macro?
Use :h execute combined with :h normal, like so:
:for i in range(1,10) | if i > 5 | exe "normal @w" | endif | endfor
Short explanation: execute/exe runs it's argument as an Ex command and normal behaves as you would press given symbols/keys yourself.
normal @w. Ornormal! @w, in case you have@mapped. – tbodt Feb 15 '17 at 17:25normal @wdidn't worked for me, but I didn't want to focus on that if usingexedid the trick – grodzik Feb 16 '17 at 07:52