vim copy and replace text

前端 未结 10 2222
名媛妹妹
名媛妹妹 2021-02-14 18:02

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 lor

10条回答
  •  生来不讨喜
    2021-02-14 18:49

    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).

提交回复
热议问题