從原始碼拿出一大段 HTML,貼到 VIM 慢慢看,覺得很想把程式碼重新排版一下,就在 Google 找到《vim combo - 程式排版》

做法是這樣:

1. 如果在插入模式 (insert mode),先按 Esc 跳回常態模式 (normal)。
2. 直接輸入 0ggVG=(第一個字是數字零,注意大小寫,畫面上不會出現你輸入的內容),輸入後按 Enter,排版完成。

依照 bluecat 的說明,這一串代表的意義如下:
0:回到行首(移到該行第0個字元)
gg:回到檔案開頭(←因為有這個,我覺得第一個0應該可以省略?)
V:視覺選取-列模式
G:到檔案結尾
=:重新排版



延線爬到 Blake 寫的一系列關於 VIM 的文章,有很多都超有趣的。 :D

Posted by fannys23 at 痞客邦 PIXNET Comments(1) Trackback(0) Hits(208)


open trackbacks list Trackbacks (0)

Comments (1)

Post Comment
  • gg=G 就可以了, 不用先回到行首

Comment Permissions: Allow commenting

Leave Comment

*Name/Nickname
E-mail
Personal Website
Comment Title
*Comment
* Private Comment