Env:Cscope安装与配置
2016-05-07 20:52
417 查看
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查看:
"......................................cscope........................... if has("cscope") set csprg=/usr/bin/cscope set csto=0 set cst set nocsverb " 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 "....................................cscope replace 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>
使用方法是,同时按下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.
相关文章推荐
- 快排,归并和Shell排序
- Linux下几种并发服务器的实现模式
- ngxtop nginx 日志实时分析
- OpenCV(学习笔记5)-Canny边缘检测
- CodeForces 599A Patrick and Shopping
- CentOS 6.3中安装Gnome桌面环境
- 中标麒麟在线不重启认存储
- 一台电脑上同启动两个Tomcat的方式,windows/Linux配置。
- 一台电脑上同启动两个Tomcat的方式,windows/Linux配置。
- 中标麒麟系统进行双网卡绑定
- Spark定制班第2课:通过案例对Spark Streaming透彻理解三板斧之二:解密Spark Streaming运行机制和架构
- Nginx 之五: Nginx服务器的负载均衡、缓存与动静分离功能
- Linux驱动LCD driver学习总结
- OpenCV(学习笔记4)-图像模糊
- Centos下yum配置lnmp环境
- OpenCV(学习笔记3)-图像腐蚀
- PopupWindow进阶
- OpenCV —数据持久化: FileStorage类的数据存取操作与示例
- ArchLinux 安装boost库
- 2016年linux学习决心书