How to copy the current line content to the end of each line for the whole file ?
For example:
From
hello
world
!
To
hello hello
world world
! !
>Solution :
:%s/^\(.*\)$/\1 \1
%– whole files/^\(.*\)$– match line from the beginning to end/\1 \1– replace it with matched text two times.
This won’t put them in a single column though if there aren’t trailing whitespaces, I’ve put here . as trailing whitespace:
# no trailing whitspaces
hello hello
hello hello
world world
! !
# with trailing whitespaces
hello hello
hello hello
world world
!.... !....