cscope usage

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

  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>
时间: 2024-10-12 03:10:54

cscope usage的相关文章

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

1.安装Vim和Vim基本插件首先安装好Vim和Vim的基本插件.这些使用apt-get安装即可:[email protected]:~/arm$sudo apt-get install vim vim-scripts vim-doc其中vim-scripts是vim的一些基本插件,包括语法高亮的支持.缩进等等.vim中文帮助文档tar包下载地址:http://sourceforge.net/projects/vimcdoc/files/vimcdoc/解压后其中有个doc文件夹, 将其中的内容

将Vim改造为强大的IDE—Vim集成Ctags/Taglist/Cscope/Winmanager

1.安装Vim和Vim基本插件 首先安装好Vim和Vim的基本插件.这些使用apt-get安装即可: lingd@ubuntu :~/arm$sudo apt-get install vim vim-scripts vim-doc 其中vim-scripts是vim的一些基本插件,包括语法高亮的支持.缩进等等. vim中文帮助文档tar包下载地址: http://sourceforge.net/projects/vimcdoc/files/vimcdoc/ 解压后其中有个doc文件夹, 将其中的

sharepoint 2013 开启 Usage and Health Data Collection

Usage and Health Data Collection Monitoring the status of your farm's health is a critical aspect of SharePoint administration. This service application collects the various logging information stored in SharePoint and writes it to the logging databa

[转]Disk Space Usage and SQL Server Performance

Disk Space Usage and SQL Server Performance By Gregory A. Larsen When you think of SQL Server performance components, you think of the usage of CPU, memory, and the I/O it takes to process a query. However, there is another component you should consi

CSS减肥的工具–Firefox插件 CSS Usage

首先,我们需要安装Firefox(猛击此处下载),或者确定你已经安装的版本已经高于3.1; 第二步,安装前端开发人员最普及的开发工具 Firebug: 第三步,安装CSS Usage 0.3.4.1: 第四步,在浏览器中打开我们要优化的页面(本地的页面也可以),点击右下角的firebug小图标,打开firebug工具窗口,我们会看到在工具选项中我们有一个 CSS Usage工具的按钮. 首先我们来分析最上面的三个功能按钮的使用 Scan: 通过字面意思我们就能知道,这是一个扫描当前页面的工具,如

Linux cscope命令

一.简介         Cscope 是一款开源免费的 C/C++浏览工具,自带一个基于文本的用户界面,通过cscope可以很方便地找到某个函数或变量的定义位置.被调用的位置等信息.Cscope对 C /C++支持较好,也可以自己定制来支持Java和Perl.Python等脚本语言.Vim和gvim都提供了cscope接口,通过适当的配置,可以在Unix/Linux下实现变量.函数.文件等之间跳转,就像Windows下的Source Insight一样灵活易用.   二.安装 1)yum安装

MAC OSX 下安装Cscope

续前文,搞定CTAGS之后,需要被搞定的是cscope,依旧是上网拖一把,具体过程如下 #1 下载cscope最新版本 http://cscope.sourceforge.net/#downloads #2 解压缩 tar xvf cscope-15.8b.tar #3 修订cscope的源文件 vim src/constants.h 在111行后添加 //#undef TERMINFO #define TERMINFO 1 #4  安装 ./configure && make all &

vim插件cscope工具的编译、安装与使用

1. 下载:http://download.chinaunix.net/download.php?id=3536&ResourceID=1900 2. 编译 # ./configure #make make 失败了: [email protected]:~/.vim/cscope-15.5# make make  all-recursive make[1]: Entering directory '/root/.vim/cscope-15.5' Making all in doc make[2]

使用 vim + ctags + cscope + taglist 阅读源码

转自:http://my.oschina.net/u/554995/blog/59927 最近,准备跟学长一起往 linux kernel 的门里瞧瞧里面的世界,虽然我们知道门就在那,但我们还得找到合适的角度才会看得更舒服,对吧^_^ . 阅读源码的工具有很多,而且如今的集成开发环境(IDE)也很强大,但对于经常使用vim编辑器的程序员来说,对vim的强大绝对是“不抛弃,不放弃”的,况且我们只要安装一些插件配合vim的工作一样能达到IDE的效果,好了,废话少说.浏览了很多有关的网页资源后,发现有