搜索此博客

2008年7月11日星期五

用Cscope帮助Vim浏览代码


  1. 建立cscope.out的脚本makecs.sh,makecs.sh 。

  2. #/bin/bash

    TEMPLATE=cscope.XXXXXX

    if [ -n "$1" ]; then
    cd "$1";

    TEMP_FILE=$(mktemp "$TEMPLATE")
    find -regex '.*\.\([ch]\|[ch][px][px]\|pgc\)' | grep -v '.svn' > "$TEMP_FILE"
    cscope -b -i "$TEMP_FILE"

    rm "$TEMP_FILE"
    else
    echo "makecs <dir>"
    exit 1
    fi

  3. Cscope插件

  4. autoload_cscope,放在./vim/plugin/或者/usr/share/vim/vim70/plugin/。我下的是0.3,78行的“find c”改成了“find s”,在175、176行加入了*.pgc。
  5. 用法

  6. C-] = 查定义

    C-\, s = 查引用

    C-\, c = 查调用

没有评论:

发表评论