Paste in Vim without moving the cursor

Viewed 6107

Often I need to paste something into several adjacent lines, at the same or similar positions. It's a pain to have to move the cursor back to the beginning of the pasted contents every time, when moving on to the next line. How can I paste (as in, the command 'p') without moving the cursor? Or, how can I quickly get the cursor back to where it was before pasting?

5 Answers

You can do it without leaving the row in the right keyboard layout (aside from p ofc):

pg;

g; goes to the previous position listed on the change list

For more info:

:help changelist
:help changes
Related