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>

 

目录
打赏
0
0
0
0
12
分享
相关文章
vim+cscope使用指南
vim+cscope使用指南
10534 2
【VIM使用技巧】一个cscope的跳转要文件保存的问题
作者:gnuhpc 出处:http://www.cnblogs.com/gnuhpc/ 在VIM下用cscope读源码,随手在文件中写点注释什么的,但是在跳转的时候必须保存才能跳转,否则提示No write since last change,这个原理我明白的,不过能不能暂时不保存或者自动保存呢,每次跳转都要:w太麻烦…… 有两种方法可以解决: set autowrite 可以自动保存 set hidden 放在buffer里不保存,等跳回来再保存。
681 0
常用vim命令和vim基本使用及Linux用户的管理,用户和组相关文件
这篇文章介绍了Vim编辑器的基本使用、常用命令和模式,以及Linux系统中用户和组的管理方法,包括用户和组相关文件如/etc/passwd、/etc/shadow和/etc/group的说明。
常用vim命令和vim基本使用及Linux用户的管理,用户和组相关文件
Linux Vim的 命令大全
Linux Vim的 命令大全
65 0
linux中vim介绍以及常用命令大全
linux中vim介绍以及常用命令大全
120 8
Linux下vim的配置
本文介绍了如何对vim进行基础配置,如行号显示、缩进设置等,并推荐了一种自动化部署方案,通过链接下载预配置的vim环境脚本,简化了配置过程,提升开发效率。
160 3
Linux下vim的配置
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等