January 9th, 2008 by vgod
之前看TextMate的Demo影片,發現TextMate能同時對多行做修改(例如,在連續十行的開頭結尾都加上<li>和</li> tag),就一直在想vim能不能做到這樣。
一直以來我在vim中都是用V把要修改的範圍選出來,再用s///搭配regular experssion做取代。這方法彈性很高,但大多時候是殺雞用牛刀,太麻煩了。
還好剛發現一個vim tip裡寫到一個簡便的新方法。簡單來說,用ctrl-v做blockwise的visual selection時,按下大寫I,就能對所選範圍同時插入一樣的文字;而按大寫A,則是在所選範圍後同時append同樣的文字。
This entry was posted
on Wednesday, January 9th, 2008 at 10:35 am and is filed under Vim.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
December 22nd, 2009 at 11:42 pm
Ctrl-V 在 gvim 中被作為「貼上」的功能鍵(如同 Windows 上習慣)
blockwise selection 有一個同義按鍵是 Ctrl-Q,也提供給看這篇文章的人作為參考
- 回覆留言(Reply)
February 2nd, 2012 at 2:13 pm
[...] Vim 一次多行編輯 中文解說 [...]