Mastering copy paste with vim

When your yanking and deleting, sometimes you come across “oh, shit” situations, where you replaced the text that you yanked with something you deleted or vice versa. Fear not, these two commands will save your day.

What you yanked (or copied) will be saved in “0 register, so to paste what you yanked, the key sequence is: “0p

What you deleted (or cut) will be saved in the “1 register, so to paste what you deleted, the key sequence is: “1p

Of course, the generic version of this is for yanking to the “x register: “xy and pasting is: “xp

The generic version of deleting is kept as an exercise 😛