作者  fcamel (飛啊!起舞的小駱駝)  看板   P_fcamel
 標題  [vim]   useful plugin: taglist & cppcomplete
 時間  Thu Jul 22 17:04:21 2004


http://www.vim.org/scripts/script.php?script_id=273   taglist
http://www.vim.org/scripts/script.php?script_id=527   cppcomplete

這些是vim的plugin, 下載解開後後複製到system或是個人的plugin目錄下即可使用
ex:
    cp *.vim /usr/local/share/vim/vim63/plugin/
    cp *.doc /usr/local/share/vim/vim63/doc/

兩者皆需要exctags這個套件, 這是比ctags更強大的套件,
ctags的功用是產生codes裡相依性, vim使用ctags的話,
使你在trace code時, 在varaible or function上按Ctrl-[會跳到定義區,
Ctrl-T會跳回上一層位置, 自己試試會比較清楚

而這兩個plugin另外強化一些功能

1.
taglist在已產生tags後 (exctags --recurse=yes SOURCE_DIR),
打 :Tlist 會產生一個分割視窗, 列出class, function等的list,
在list window裡可以按ENTER跳到定義的source code去, 類似IDE的object管理window

2.
cppcomplete則是提供補字功能, from cppcomplete.vim:
" This plugin helps you complete things like:
" variableName.abc
" variableName->abc
" typeName::abc
" from the members of the struct/class/union that starts with abc.

由於它不是透過parser檢查的, 只是利用ctags產生的tags做字串比對,
功能相較IDE來說, 陽春許多

當第一次使用時, 它會自動生出cppcomplete.tags, 使用的指令為:
ctags -n -f cppcomplete.tags --fields=+ai --C++-types=+p *

所以若裝好exctags後, 看是把exctags link到ctags,
或是改cppcomplete的設定, 我是採前者的動作

用法: (in insert mode)
F5     跳出分割視窗, 列出class的內容
F8/F9  補字選項的 next/prev