I wanted to copy a series of lines to a specific place in a file, and these are the options I see, all with g
, the first two from the power of g
- clear register, copy matching lines to register, paste from register
- copy to end of file, jump to end of file, yank lines, jump back and paste
:g/pattern/t80
paste to the specific line I'm at, reverse order of lines with!tac
All of them are actually a bit convoluted, I think probably 1 is the fastest, as you don't have to check the line number where you want to paste. Is there another way, where I place my cursor to where I want the lines pasted and they get pasted in order?
:g/pattern/t.
?.
refers to the current line. There is also-
, which refers to the line above.:global
,.
is the line on which the command argument to:global
is running.