Cscope

首先建立.vim/plugin資料夾
http://cscope.sourceforge.net/cscope_maps.vim放進去

在你想建立所有搜尋檔案的目錄下,接著執行cscope -R -q
可以看到以下畫面
Cscope version 15.5 Press the ? key for
help

Find this C symbol:
Find this global definition:
Find functions called by this function:
Find functions calling this function:
Find this text string:
Change this text string:
Find this egrep pattern:
Find this file:
Find files #including this file:
你可以找尋所要的檔案或是字串
搜尋結果會在上面列出來,按enter可以進入編輯檔案:q可以在回到此畫面

在編輯檔案時,cscope的所有指令都是以Ctr+\為開頭
把游標移到你想要搜尋的字串上
可以下以下的指令
c: Find functions calling this function
d: Find functions called by this function
e: Find this egrep pattern
f: Find this file
g: Find this definition
i: Find files #including this file
s: Find this C symbol
t: Find assignments to
另外Ctrl+t是回到你上一次查尋的地方,Ctrl+]則是再跳回
最後Ctrl+d就是結束程式

在vim下
:cs find e xxxx
基本使用大概是這樣

Page tags: linux vim
page_revision: 1, last_edited: 1229567358|%e %b %Y, %H:%M %Z (%O ago)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License