作者 kcwu (小光光) 看板 vgodroom 標題 coding with vim 時間 Sun Sep 8 20:16:12 2002 ─────────────────────────────────────── 基本上點到為止, 還是請 RTFM :) 本文轉錄僅需知會, 不須徵求同意 :) * 無關 coding CTRL-O CTRL-I 前後移動最近去過的檔案/位置 CTRL-^ 最後兩個檔案切換 gj gk 當一行太長被 wrap 時, visual 上下移動 * quickfix :make 可以 make (或改 makeprg), 有錯可以 :cn :cp 移動修正 也有 :grep, 也行 :cn :cp 可以用 :col :cnew 切換前後一次的 make/grep 結果 :cw 可以開個 quickfix window 來看 make/grep 的結果 * tag 系統的 ctags 似乎比較遜, 去裝新的 (ports/devel/ctags) CTRL-] CTRL-T 可以在 tag 前後移動 |quickfix.txt| commands for a quick edit-compile-fix cycle * move/hint [[,]],[(,etc. 前後移動 function/括號之類的 gd gD [i [-CTRL-I 看區域/全域變數的定義, 甚至包括 include 檔, 或跳過去 :ptag :psearch 會開一個 preview window, 印出游標所在 tag/word 的內容 * auto complete vim 有很多種 complete, 不過我用不習慣 *ins-completion* Insert mode completion * tips #277 把 ( bind 到 :psearch 上 於是可以輸入 func( 時, 自動 hint prototype #102 smart mapping for tab completion 不過我用不習慣 #305 有很多 tips * scripts $VIMRUNTIME/macros/matchit.{txt,vim} 讓 % 不止 match 括號, 還可以 \begin if endif .... #84 gdbvim/ #168 idevim 前者把 vim 變成 gdb 的 frontend, 後者把 gdb 變成 vim 的一個 window. 於是可以 run to cursor, set breakpoint on thisline 之類 雖然我還是習慣直接 run gdb #152 ShowMark #90 cvscommand,#21 info 在 vim 裡用 cvs, info #273,#69,#215,#208 可以玩玩看, 我還沒試過 #199 Read file in proper encoding * manual |usr_29.txt| Moving through programs |usr_30.txt| Editing programs |usr_08.txt| Splitting windows |usr_28.txt| Folding