tags:

views:

59

answers:

1

in gVim, I am trying to do

q 2 dd j q

Then

@2

at several points later. It works the first time (meaning vim deletes three lines and moves down when I type @2), but anytime after that, my screen blinks and the cursor moves down once.

Is there a setting I need in vimrc or something to allow this macro?

+11  A: 

What is happening is that Vim uses the Numbered registers to store recent changes made with the yank and delete commands. That will wipe your macro from the register.

As a general recommendation, avoid the numeric registers when recording macros.

CMS
Good to know, thanks.
BioBuckyBall
+1 I stumbled on this problem recently as well, and it took some time to figure out using a number for the macro name caused the problem. Now I know why :)
Ton van den Heuvel
Seems like every macro I record needs to save to a register...I wish there was a more convenient way to do it. The best one can hope for is 'macro best practices'. I couldn't find anything particular to the user of registers (which deserves attention, obviously!). But I'm in love with the tips at the Vim wiki, so, plug: http://vim.wikia.com/wiki/Macros
dsummersl