Reputation: 1575
Such as title, I want to copy all lines and paste at the end.
BEFORE:
apple
cat
dog
sun
AFTER:
apple apple
cat cat
dog dog
sun sun
Upvotes: 0
Views: 167
Reputation: 1694
Another way , if your text is like this(~ represents blank)
apple
cat~~
dog~~
sun~~
It means that all word has the same numbers of colomn.
you can ctrl-v
to select all and move cursor to the end of "apple" and type p
to paste.
Upvotes: 0
Reputation: 196546
Another unix-style answer (though I would go with any of @FDinoff's solution):
:%!awk '{print $1, $1}'
And another :normal
answer because there's so many ways to enjoy skinning a cat:
:%norm y$A <C-v><C-r>"
And another one:
:%norm y$Pa<space> <-- just press the <space> bar
Upvotes: 0
Reputation: 31429
Use a substitue command
:%s/.*/& &
Where .*
matches everything and &
is replaced with the match (in this case the whole line)
Or if you really want to yank the lines you could use a normal command
:%norm yyPJ
Which is run the command yyPJ
on every line in normal mode.
Note: These commands will give slightly different output if there is leading whitespace.
Upvotes: 7