zoukankan      html  css  js  c++  java
  • Env:Cscope安装与配置

    1. 介绍

    Cscope是类似于ctags一样的工具,但可认为他是ctags的增强版。

    2. 安装

    • sudo apt-get install cscope
    • 通过源码安装,参照http://blog.csdn.net/hpwzd/article/details/7405401

    3. 配置

    • 在源码所在目录下,执行cscope -Rbkq 会生成三个文件:cscope.out/csope.in.out/cscope.po.out
    • 在Vimrc中添加如下一段话,其中/usr/bin/cscope为可执行文件所在目录,如果没有vimrc,那就新建,可以通过whereis查看:
    •  1 "......................................cscope...........................       
       2 if has("cscope")
       3     set csprg=/usr/bin/cscope
       4     set csto=0
       5     set cst
       6     set nocsverb
       7     " add any database in current directory
       8     if filereadable("cscope.out")
       9     cs add cscope.out
      10     " else add database pointed to by environment
      11     elseif $CSCOPE_DB!=""
      12         cs add $CSCOPE_DB
      13     endif
      14     set csverb
      15 endif
      16 "....................................cscope replace
      17 nmap <C-@>s :cs find s <C-R>=expand("<cword>")<CR><CR>
      18 nmap <C-@>g :cs find g <C-R>=expand("<cword>")<CR><CR>
      19 nmap <C-@>c :cs find c <C-R>=expand("<cword>")<CR><CR>
      20 nmap <C-@>t :cs find t <C-R>=expand("<cword>")<CR><CR>
      21 nmap <C-@>e :cs find e <C-R>=expand("<cword>")<CR><CR>
      22 nmap <C-@>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
      23 nmap <C-@>i :cs find i <C-R>=expand("<cfile>")<CR><CR>
      24 nmap <C-@>d :cs find d <C-R>=expand("<cword>")<CR><CR>

      使用方法是,同时按下Ctrl+@后松开按下's':

      • Ctrl+@-> s ---- 查找C语言符号,即查找函数名、宏、枚举值等出现的地方
      • Ctrl+@-> g ---- 查找函数、宏、枚举等定义的位置,类似ctags所提供的功能
      • Ctrl+@-> d ---- 查找本函数调用的函数
      • Ctrl+@-> c ---- 查找调用本函数的函数
      • Ctrl+@-> t  ---- 查找指定的字符串
      • Ctrl+@-> e ---- 查找egrep模式,相当于egrep功能,但查找速度快多了
      • Ctrl+@->  f ---- 查找并打开文件,类似vim的find功能
      • Ctrl+@->  i ---- 查找包含本文件的文

    需要注意的是:

    • 打开源文件需要在cscope.out路径下打开,如$ vi ./drivers/tty/serial/imx.c而不是到serial目录下执行$ vi imx.c.否则会出现找不到cscope.
    • 查找进入新的文件后,退回去快捷键:Ctrl+t.
  • 相关阅读:
    大型网站调试工具之一(php性能优化分析工具XDebug)
    2.0控件之Border, Button, Calendar, Canvas, CheckBox, ComboBox
    C#程序开发范例_IC卡读写
    数据库连接池技术
    控件之DataGrid, DatePicker, Grid, GridSplitter, HyperlinkButton, Image
    软件工程师职业总结
    "EMQ Meetup北京"技术沙龙分享会
    EMQ X Enterprise 新功能 Rule Engine 介绍
    基于 MySQL 的 EMQ X Auth & ACL
    MQTT 5.0 新特性(三)— 有效载荷标识与内容类型
  • 原文地址:https://www.cnblogs.com/aaronLinux/p/5469158.html
Copyright © 2011-2022 走看看