Vim replace ? - Linux

Table of Contents

一個小問題想請教大家~

假如今天有一個文件是這樣

test.txt

11111111_222222_44444_6666*
11111111_222222_44444_6666*
asdasdsa_222222_44444_6666*
dededeed_222222_44444_6666*
rrrrrrrr_222222_44444_6666*
11111111_222222_44444_6666*

今天我想把 這個字串 => "6666"

換掉成 7777
我應該會輸入

ESC
:%s/6666/7777/g

到這邊沒有問題

但是假如 "6666" 這個字串很長 可能是 "666666666666"

所以我可能會在文件上複製 "6666666666" 這個字串 (就是按 y 複製)

但是我在EX指令模式下 我不知道要怎樣貼上我剛剛複製的字串

我的意思是 我可能按下

ESC
:%s/????/7777/g
^
這邊我想用貼上的方法貼上字串 但是我不知道要怎麼按?

因為字串很長想用貼上的方法比較快

不知道有秘技可以分享一下嗎?


--

All Comments

Aaliyah avatarAaliyah2010-01-02
ctrl-r 0
William avatarWilliam2010-01-06
ctrl-r 0也可以應用在insert mode的貼上中:)
Gary avatarGary2010-01-11
感謝樓上兩位~
Xanthe avatarXanthe2010-01-12
請請問樓上這類的東西 help 要打什麼東西去查阿?
Ivy avatarIvy2010-01-13
不知道怎麼直接help查 但有空把':help'看一看吧
usr_24.txt cmdline.txt insert.txt都有提到