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?
If you want to run a macro repeatedly, type a number before pressing the @ key. Example: 23@a will repeat macro " a " 23 times. Press @@ to repeat the last macro. This does not work instantly after recording, you need explicitly call the macro once.
To clear a single macro - record over it - with nothing. For your situation in normal mode you'd just type "qwq".
Viewing a macro You can use the :registers command to view the current contents of any or all register values in Vim. For example, use :reg to view all registers, or :reg a to view only what you have recorded into register a . Typing :reg abx will show the contents of registers a, b, and x.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With