vim+ctags+taglist+cscope

http://sourceforge.net/projects/vimcdoc/ vim中文文檔
http://graceco.de/manual/cscope_vim_tutorial_zh.html cscope

vim + ctags +taglist

search taglist on www.sourceforge.net
sudo apt-get install ctags

創建tags

ctags * -R

解壓taglist_45.zip
~/.vim/plugin/taglist.vim

把以下這一行加到taglist.vim中
let Tlist_Ctags_Cmd="/usr/bin/ctags"

如下:

let s:cpo_save = &cpo
set cpo&vim

let Tlist_Ctags_Cmd="/usr/bin/ctags"

if !exists('loaded_taglist')
    " First time loading the taglist plugin
    "
    " To speed up the loading of Vim, the taglist plugin uses autoload
    " mechanism to load the taglist functions.
    " Only define the configuration variables, user commands and some
    " auto-commands and finish sourcing the file

    " The taglist plugin requires the built-in Vim system() function. If this
    " function is not available, then don't load the plugin.
    if !exists('*system')

打開vim導入tags
:set tags=/Users/peter/workspace/zxv10_vcs/i2c-tools-3.0.2/tags

打開符號表
:Tlist

幾個有用的命令

ctrl + w w 在Taglist 和正常窗口之間切換
:split 2  把窗口分爲上下兩個
ctrl + w j 切換到下面的窗口
ctrl + w k 切換到上面的窗口
ctrl + ] 跳轉到tag定義
ctrl + o 返回上一個位置
ctrl + i 前進到下一個位置
:ju -> 顯示所有的可以跳躍的地方 (print jump list)
:edit <filename> 打開編輯某個文檔

cscope

Intall: sudo apt-get install cscope
Set key maps: wget http://cscope.sourceforge.net/cscope_maps.vim && mv cscope_maps.vim ~/.vim/plugin/
'cs add cscope.out' has also been included in this plugin.

find /my/project/dir -name '*.c' -o -name '*.h' > /foo/cscope.files
cscope -b -i /foo/cscope.files

#!/bin/bash
if [ $# -lt 1 ]
then
        echo "Usage $0 <directory> [directory] ..."
        echo
        exit
fi
find $@ -name "*.h" \
-o -name "*.c" \
-o -name "*.cc" \
-o -name "*.cpp" \
-o -name "*.java"

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章