I’m trying to walk through my buffers list, select a single line from each buffer, and to have them all concatenated into a single file (or other buffer). As in:
file1
…
line2
…
file2
…
line2
…
file3
…
line2
…
and so on.
all into:
myfile
line2 (file1)
line2 (file2)
line2 (file3)
I can’t seem to get my registers working, and bufdo is causing me heartache for some reason…
[clarification]
I was hoping I could use bufdo to walk through all my buffers, yank the second line from each, and append it into a register.
Then on another file, just paste the register contents into it (containing the second line from all of my buffers).
You should be able to do this with something like:
which iterates through the buffers and runs the given command in normal mode.
2Gjumps to the appropriate line, and"Ayyanks into register a, appending instead of overwriting (since the A is capitalized). Make sure register a is empty before you start!You can use
windoortabdoif you have windows or tabs instead of buffers.