码迷,mamicode.com
首页 > 系统相关 > 详细

【linux】——cscope

时间:2016-02-16 16:34:29      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:

  cscope是一款linux下的软件,其功能主要是用在阅读代码,堪称Windows下的Source Insight,但是配合vim使用,效率无与伦比。如需了解其具体使用,请先安装vim,然后在终端执行vim命令,并在命令行执行  :help cs 。以下提供测试过的配置。以下是 ~/.vimrc 中的配置。

set nu
set shiftwidth=4
set tabstop=4
set softtabstop=4
set autoindent

nmap <F2>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <F2>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <F2>d :cs find d <C-R>=expand("<cword>")<CR><CR>
nmap <F2>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <F2>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <F2>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <F2>f :cs find f <C-R>=expand("<cword>")<CR><CR>
nmap <F2>i :cs find i <C-R>=expand("<cword>")<CR><CR>

colorscheme desert

if has("cscope")
    set csprg=/usr/local/bin/cscope
    set csto=0
    set cst 
    set nocsverb
    set cscopequickfix=s-,c-,d-,i-,t-,e-
    " 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

  有了以上配置,使用方法如下:

  F2 + s    Find this C symbol

  F2 + g    Find this definition

  F2 + d    Find functions called by this function

  F2 + c    Find functions calling this function

  F2 + t    Find this text string

  F2 + e    Find this egrep pattern

  F2 + f    Find this file

  F2 + i    Find files #including this file

让代码在键盘上飞起来吧!

end!

 

【linux】——cscope

标签:

原文地址:http://www.cnblogs.com/ngnetboy/p/5192850.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!