1. 程式人生 > >vim-cscope外掛

vim-cscope外掛

在工程根目錄生成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這個檔案的檔案(們)
---------------------

原文:https://blog.csdn.net/magiclyj/article/details/79660259