One of the most common task that beginners struggle to do in Vim is copying and pasting a line.
In reality though, it is very simple.
Type "yy" to copy a line, then "p" to paste it into the other place.
Now if you have some time, let's take a closer look at what's happening there. To copy a line,
Esc
to be sure. Then copy the entire line by pressing yy
(more info :help yy
). Y stands for "yank
". Instead, you can also press Y
(shift + y) but I find the former a bit more convenient.p
. That will put the yanked line right under your cursor (on the next line). You can also paste before your current line by pressing the capital letter P
. Again, to get some help you can use :help p
.Hopefully that was helpful.
If you are serious about using Vim in your workflow, make sure to get familiar with the most popular plugins around there.
Have a productive day!