Friday, November 16, 2007
Most Vim users know about macros and find them useful; however, until recently, I didn't realize they are actually stored in the same registers we all know and love. For example, you create a new macro by pressing `qa'. You type in a series of commands that you would like to repeat, end the macro, done. But wait, you made a mistake. Well, you can easily edit the macro stored in `qa'. I typically issue a :new to open a new window, move my cursor to that window and then "ap. The contents of the macro are printed to the window. From there, you can edit the macro as needed and then yank the macro back in to the desired register by executing something like 0"ay$. Once yanked, the new macro will execute as you would expect it would.