對於專案開發可以說是非常方便
在Ubuntu的安裝過程如下
1. 首先安裝exuberant-ctags
$ sudo apt-get install exuberant-ctags2. 之後再裝vim plugin:taglist
到taglist下載頁面下載taglist.vim,有許多版本可以選擇,今天我們下載taglist_4.6.zip。
此為一個打包好的zip壓所檔,所以要先將之解壓縮:
$ unzip taglist_46.zip解壓縮後會出現兩個資料夾,一個是放說明文件taglist.txt的doc與放taglist.vim本身的plugin
這些檔案要放在HOME目錄底下的.vim目錄,vim本身不會自動創這個目錄,因此我們自己創並且把東西放進:
$ mkdir -p ~/.vim $ mv doc ~/.vim && mv plugin ~/.vim如此一來就大功告成! 安裝完後,如果要開起tag list功能,只要在vim中輸入command:
:TlistToggle就會出現啦!再輸入同樣的一次就會關閉
如果覺得每次都要輸入麻煩,可以自己做shortcut,另外也有一些客製化選項供我們使用,可以參考Taglist Manual
編輯~/.vimrc,加入以下幾行:
""" taglist plugin nnoremap <silent> <F2> :TlistToggle<CR> let Tlist_WinWidth = 30 " the taglist width let Tlist_WinHeight = 100 " the taglist height let Tlist_Enable_Fold_Column = 1 " dispaly the fold column let Tlist_Display_Prototype = 1 " show the prototype let Tlist_Auto_HighLight_Tag = 1 " automatically highlight the current tag in the taglist let Tlist_Exit_OnlyWindow = 1 " close vim if the taglist the only window let Tlist_File_Fold_Auto_Close = 1 " close tag folds for inactive buffers
之後只要按F2就會有同樣效果了。
沒有留言:
張貼留言