Vim cscope

简介: /********************************************************************** * Vim cscope * 说明: * 之前使用Vim进行代码跟踪,都是通过Vim+ctags,传言中是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>

 

目录
相关文章
|
NoSQL 数据库 开发工具
vim+cscope使用指南
vim+cscope使用指南
9810 1
|
开发工具
【VIM使用技巧】一个cscope的跳转要文件保存的问题
作者:gnuhpc 出处:http://www.cnblogs.com/gnuhpc/ 在VIM下用cscope读源码,随手在文件中写点注释什么的,但是在跳转的时候必须保存才能跳转,否则提示No write since last change,这个原理我明白的,不过能不能暂时不保存或者自动保存呢,每次跳转都要:w太麻烦…… 有两种方法可以解决: set autowrite 可以自动保存 set hidden 放在buffer里不保存,等跳回来再保存。
650 0
|
4天前
|
Linux 开发工具
Linux的学习之路:5、粘滞位与vim
Linux的学习之路:5、粘滞位与vim
46 0
|
4天前
|
NoSQL Linux 编译器
Linux:vim调试工具gdb | 常见命令集
Linux:vim调试工具gdb | 常见命令集
104 0
|
4天前
|
搜索推荐 NoSQL Linux
Linux开发工具——vim篇
Linux开发工具——vim篇
|
4天前
|
Ubuntu Linux 编译器
【Linux】4. 开发工具的使用(yum/vim)
【Linux】4. 开发工具的使用(yum/vim)
48 2
|
4天前
|
Linux 编译器 开发工具
Linux学习第二枪(yum,vim,g++/gcc,makefile的使用)
Linux学习第二枪(yum,vim,g++/gcc,makefile的使用)
|
4天前
|
弹性计算 Unix Linux
Linux:文本编辑器 - vim
Linux:文本编辑器 - vim
14 1