1) Reference:

Linux 平台下阅读源码的工具链

程序员的利器 – cscope

2) cscope help:

:help cscope

:help cscope-suggestions

:cs help

3) Generate index files:

find fullpath/of/your/project –type f > cscope.files

cscope -bq

4) cscope command:

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 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

5) Add cscope setting in .vimrc:

if has("cscope")     

  set csprg=/usr/local/bin/cscope     

  set csto=     

  set cst     

  set nocsverb     

  " add any database in current directory     

  if filereadable("cscope.out")         

    cs add cscope.out     

  " else add database pointed to by environment     

  elseif $CSCOPE_DB != ""         

    cs add $CSCOPE_DB     

endif     

set csverb endif

nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR> 

nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR> 

nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR> 

nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR> 

nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR> 

nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR> 

nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR> 

nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>

" Using 'CTRL-spacebar' then a search type makes the vim window 

" split horizontally, with search result displayed in 

" the new window.

nmap <C-Space>s :scs find s <C-R>=expand("<cword>")<CR><CR> 

nmap <C-Space>g :scs find g <C-R>=expand("<cword>")<CR><CR> 

nmap <C-Space>c :scs find c <C-R>=expand("<cword>")<CR><CR> 

nmap <C-Space>t :scs find t <C-R>=expand("<cword>")<CR><CR> 

nmap <C-Space>e :scs find e <C-R>=expand("<cword>")<CR><CR> 

nmap <C-Space>f :scs find f <C-R>=expand("<cfile>")<CR><CR> 

nmap <C-Space>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR> 

nmap <C-Space>d :scs find d <C-R>=expand("<cword>")<CR><CR>

" Hitting CTRL-space *twice* before the search type does a vertical 

" split instead of a horizontal one

nmap <C-Space><C-Space>s     \:vert scs find s <C-R>=expand("<cword>")<CR><CR> 

nmap <C-Space><C-Space>g     \:vert scs find g <C-R>=expand("<cword>")<CR><CR> 

nmap <C-Space><C-Space>c     \:vert scs find c <C-R>=expand("<cword>")<CR><CR> 

nmap <C-Space><C-Space>t     \:vert scs find t <C-R>=expand("<cword>")<CR><CR> 

nmap <C-Space><C-Space>e     \:vert scs find e <C-R>=expand("<cword>")<CR><CR> 

nmap <C-Space><C-Space>i     \:vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR> 

nmap <C-Space><C-Space>d     \:vert scs find d <C-R>=expand("<cword>")<CR><CR>

cscope usage的更多相关文章

  1. 将Vim改造为强大的IDE—Vim集成Ctags/Taglist/Cscope/Winmanager/NERDTree/OmniCppComplete(有图有真相)(转)

    1.安装Vim和Vim基本插件首先安装好Vim和Vim的基本插件.这些使用apt-get安装即可:lingd@ubuntu:~/arm$sudo apt-get install vim vim-scr ...

  2. 〖Linux〗(2013.08.02)使用ctag+cscope查看Android源代码

    1. 安装ctags和cscope sudo apt-get install -y exuberant-ctags cscope 2. vimrc中的配置 """&quo ...

  3. vim插件cscope使用方法

    一.安装cscope 安装方式比较多样,可以在各自linux软件管理工具中安装,也可以去官网下载安装. sudo apt-get install cscope 二.插件安装 这里选择的是Vundle来 ...

  4. 安装windows下的Cscope

    http://blog.csdn.net/maxiee/article/details/10034263 Cscope 是一款用于查看大型工程中的代码的软件.它使用方便,支持快速查找 C Symbol ...

  5. intellij IDEA 出现“Usage of API documented as @since 1.6+”的解决办法

    问题 在导入java.io.console的时候出现"Usage of API documented as @since 1.6+"

  6. Disk Space Usage 术语理解:unallocated, unused and reserved

    通过standard reports查看Disk Usage,选中Database,右击,选择Reports->Standard Reports->Disk Space Usage,截图如 ...

  7. OpenCascade MeshVS Usage

    OpenCascade MeshVS Usage eryar@163.com Abstract. MeshVS means Mesh Visualization Service. It can be ...

  8. Usage: AddDimensionedImage imageFile outputFile eclipse 运行程序出错

    关于这个在eclipse中运行java程序的错,首先确认你的jdk,jre是否完整,并且与你的eclipse的位数相同,当然我相信这个错误大家应该都会去检查到. 第二个关于addDimensioned ...

  9. Please allow Subclipse team to receive anonymous usage statistics for this Eclipse intance(info)

    本文转载自:http://blog.csdn.net/myfxx/article/details/21096949 今天在用eclipse启动项目的时候发现了一个问题,就是每次启动项目的时候,ecli ...

随机推荐

  1. java 接口实现多态

    package unit4; import java.awt.Graphics; public interface Shape { void drowme(Graphics g); double ar ...

  2. iOS tableView Section圆角方案

    给tableView的section设置圆角 首先给让cell左右偏移一点的距离,通过重写cell的setframe方法来实现 -(void)setFrame:(CGRect)frame{ CGFlo ...

  3. [译]GLUT教程 - 创建和关闭子窗体

    Lighthouse3d.com >> GLUT Tutorial >> Subwindows >> Creating and Destroying Subwind ...

  4. 图论——Dijkstra+prim算法涉及到的优先队列(二叉堆)

    [0]README 0.1)为什么有这篇文章?因为 Dijkstra算法的优先队列实现 涉及到了一种新的数据结构,即优先队列(二叉堆)的操作需要更改以适应这种新的数据结构,我们暂且吧它定义为Dista ...

  5. vim visual模式 复制

    按ESC再按“V”,进入visual模式 用键盘向左向右箭头选中要复制的文字,按两下"Y"键 再到要粘贴的地方,按“P”键即可. 转自: http://jingyan.baidu. ...

  6. Python 自动化之验证码识别

    之前公司的验证码比较简单,可以采取直接破解的方式进行登录 部分代码如下: # -*- coding: utf-8 -*- from selenium import webdriver from sel ...

  7. thinkPHP5.0的学习研究【基础】

    2017年6月19日13:25:56 基础:1.ThinkPHP5的环境要求如下: PHP >= 5.4.0        PDO PHP Extension        MBstring P ...

  8. 九度OJ 1205:N阶楼梯上楼问题 (斐波那契数列)

    时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:3739 解决:1470 题目描述: N阶楼梯上楼问题:一次可以走两阶或一阶,问有多少种上楼方式.(要求采用非递归) 输入: 输入包括一个整 ...

  9. 九度OJ 1182:统计单词 (计数)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3920 解决:1443 题目描述: 编一个程序,读入用户输入的,以"."结尾的一行文字,统计一共有多少个单词,并分别输出 ...

  10. 【python】-- 协程介绍及基本示例、协程遇到IO操作自动切换、协程(gevent)并发爬网页

    协程介绍及基本示例 协程,又称微线程,纤程.英文名Coroutine.一句话说明什么是协程:协程是一种用户态的轻量级线程. 协程拥有自己的寄存器上下文和栈.协程调度切换时,将寄存器上下文和栈保存到其他 ...