Reputation: 1160
I've got a large config file that i'm in the process of splitting out into individual ones based on section.
My workflow is like this:
I tried creating a macro to do this, basically taking the steps above, but add (q a) right before cutting the text, and q again right after pasting. My macro stops as soon as the new buffer is open and won't run the paste command. I have to do this by hand.
Ideally: those steps above would complete to the point where I'd be left with the :wq! entered into the command line just waiting for me to give a filename and hit enter to close and save the buffer.
Is this possible, and how would I accomplish it without writing a script?
Edit
Found another faster way to do the same thing:
Still curious why my recorded macro stops when a new buffer is created, though.
Upvotes: 0
Views: 320
Reputation: 8819
I had the same issue as you. I found out that the q after the p was not stopping the macro recording. I hope this is what you were seeing. To populate register a with content you can run (the ^@ is entered by ctrl-v, ctrl-j):
let @a="d:sp! newfile.pp^@p"
Upvotes: 2