在工程根目录生成cscope.out 索引文件的脚本
rm -f cscope*
currentPath=$(pwd )
echo $currentPath
find $currentPath -name "*.h" -type f -o -name "*.c" -type f -o -name "*.cc" -type f -o -name "*.cpp" -type f > cscope.files
cscope -bkq -i cscope.files
vim命令模式查找:cs find 可以简写为 cs f
eg 查找文件名: cs f f filename
以下为引用
在vim中使用cscope非常简单,首先调用”cscope add”命令添加一个cscope数据库,然后就可以调用”cscope find”命令进行查找了。
vim支持8种cscope的查询功能,如下:
0或者s: 查找C语言符号,即查找函数名、宏、枚举值等出现的地方
1或者g: 查找函数、宏、枚举等定义的位置,类似ctags所提供的功能
2或者d: 查找本函数调用的子函数
3或者c: 查找调用本函数的父函数
4或者t: 查找指定的字符串
6或者e: 查找egrep模式,相当于egrep功能,但查找速度快多了
7或者f: 查找并打开文件,类似vim的find功能
8或者i : 查找#include这个文件的文件(们)
---------------------