[vim] vim中使用cscope的安装与使用
生活随笔
收集整理的這篇文章主要介紹了
[vim] vim中使用cscope的安装与使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
From: http://blog.sina.com.cn/s/blog_498a6eeb0100v05m.html
1. 下載cscope-15.7
http://dldx.csdn.net/fd.php?i=878111800792509&s=924cf0d6a0f63bb6ca24f900
解壓所里面有三個文件, 放到vim的安裝目錄下即可。
2.建索引
-b
http://cscope.sourceforge.net/cscope_man_page.html
執行結束后你可以在當前目錄下發現cscope.out文件,這就是cscope建立的符號數據庫。上面這個命令中,-b參數使得cscope不啟動自帶的用戶界面,而僅僅建立符號數據庫
3. 在vim命令行下執行:
:cs help cscope commands: add : Add a new database (Usage: add file|dir [pre-path] [flags])find : Query for a pattern (Usage: find c|d|e|f|g|i|s|t name)c: Find functions calling this functiond: Find functions called by this functione: Find this egrep patternf: Find this fileg: Find this definitioni: Find files #including this files: Find this C symbolt: Find assignments tohelp : Show this message (Usage: help)kill : Kill a connection (Usage: kill #)reset: Reinit all connections (Usage: reset)show : Show connections (Usage: show)
s: 查找C語言符號,即查找函數名、宏、枚舉值等出現的地方
g: 查找函數、宏、枚舉等定義的位置,類似ctags所提供的功能
d: 查找本函數調用的函數
c: 查找調用本函數的函數
t: 查找指定的字符串
e: 查找egrep模式,相當于egrep功能,但查找速度快多了
f: 查找并打開文件,類似vim的find功能
i: 查找包含本文件的文
使用cscope查找do_fork函數的定義:
在vim命令行下執行: :cs f g do_fork每次輸入這樣挺麻煩, 下載一個插件cscope_quickfix.vim 。http://www.vim.org/scripts/download_script.php?src_id=2635在_vimrc中增加:"cscope"If you want to use Popup menu for :Cscope command, put a line in .vimrc like:let Cscope_PopupMenu = 1這樣可以在右鍵中彈出菜單。這樣就可以不用記命令。
總結
以上是生活随笔為你收集整理的[vim] vim中使用cscope的安装与使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php spl_autoload_reg
- 下一篇: 计算机中职课程表,计算机专业课程表