Lets say that i have this text:
$test = 'lorem'; $test2= 'ipsum';
and I want to copy lorem and paste into ipsum.
I tried to do yi'
on lorem and then went on ipsum and did ci'
but that replaced my pastebin with ipsum. and my previous copy was lost.
Go to the l of lorem, ye (yank to end of word). Go to the i of ipsum, "_de (delete to end of word, putting the deleted text in the black hole register. P (paste register before cursor).
Altogether: yej"_deP
I'm not sure what do you want exactly.
You have this on two lines:
If you go to l and yw, it yanks lorem, then go to i of ipsum, and cw, and p and it will replace ipsum with lorem. You will still have both lorem and ipsum in the registers.
You can get the contents of those registers with :reg
If you want to paste something from them then "*p, or ":p, or "0p (you'll see it when you type :reg)
yi' on lorem, move to i of ipsum, vep?
Easy:
"kyi' on lorem, move to i of ipsum, ve"kp
This yanks lorem into register k, pastes it over ipsum from register k, and keeps it in register k ready to paste again anywhere else you might want to put it. ipsum still ends up in the default register, but that's no longer a problem and could be useful too.
If you've already got something in register k, you can use a different register instead (just use a different key).