Monday, December 14, 2009

VI的字串取代方式

C  (游標處至行尾取代)
cw (取代字串)
cW (取代整份字串,以空白位分界)
:%s/word1/word2/g  (整個文章word1被word2取代)
:%s/word1/word2/gc (整個文章word1被word2取代,取代先詢問)
:n1,n2s/word1/word2/gc (n1~n2行中的word1被word2取代,取代先詢問)
:n1,$s/word1/word2/gc (n1~檔尾中的word1被word2取代,取代先詢問)

:n1,n2con3 (n1~n2複製到n3)
:n1,n2mon3 (n1~n2移動到n3)
:n1,n2de   (n1~n2刪除)

No comments:

Post a Comment