Vim cscope

/**********************************************************************
 *                            Vim cscope 
 * 说明:
 *     之前使用Vim进行代码跟踪,都是通过Vim+ctags,传言中是cscope会相对
 * 更强大,更有效,所以抽点空学习一下。
 *
 *                                    2016-4-10 深圳 南山平山村 曾剑锋
 *********************************************************************/

一、参考资料:
    1. Editor Tips
        http://elinux.org/Editor_Tips
    2. 在Vim中使用cscope
        http://www.cnblogs.com/sunj/archive/2012/03/12/2391610.html
    3. The Vim/Cscope tutorial
        http://cscope.sourceforge.net/cscope_vim_tutorial.html
    4. vi/vim使用进阶: 程序员的利器 – cscope
        http://easwy.com/blog/archives/advanced-vim-skills-cscope/

二、安装cscope
    sudo apt-get install cscope

三、创建Linux kernel cscope ARM库
    make ARCH=arm cscope

四、现象:
    zengjf@zengjf:~/kernel$ make ARCH=arm cscope
      GEN     cscope
    zengjf@zengjf:~/kernel$ ls cscope.*
    cscope.files  cscope.out  cscope.out.in  cscope.out.po
    zengjf@zengjf:~/kernel$ 

五、.vimrc配置
    ......
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " cscope setting
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    if has("cscope")
        set csprg=/usr/bin/cscope
        set csto=1
        set cst
        set nocsverb
        " add any database in current directory
        if filereadable("/home/zengjf/kernel/cscope.out")
            cs add /home/zengjf/kernel/cscope.out
        endif
        set csverb
        set cscopetag
    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>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值