vi和ctags,cscope

1.检查使用的vi或者vim是否支持cscope

$ vi --version| grep cscope
-cryptv -cscope -cursorshape -dialog -diff -digraphs -dnd -ebcdic -emacs_tags

$ vim --version | grep cscope
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff
Features included (+) or not (-)

+表示支持,-表示不支持。由上面的结果可以看出,vi不支持,vim支持;
可以看一下他们的路径,就知道他们不是不同的可执行程序;

$ which vi
/bin/vi
$which vim
/usr/bin/vim

2.如果vim没有支持cscope的话,可以自己下载vim的source进行编译:

2.1 download src from http://www.vim.org/download.php
2.2 extract gat file, cd src/
2.3 make distclean; rm auto/config.cache
2.4 edit Makefile file
    430 # CSCOPE
    431 # Uncomment this when you want to include the Cscope interface.
    432 #CONF_OPT_CSCOPE = --enable-cscope -->
        CONF_OPT_CSCOPE = --enable-cscope
    or ./configure --enable-cscope
2.5 su root

    make; make INSTALL


3. 对所有的目录使用ctags和cscope
   ctags -R *
   cscope -R

   vim -t yoursymbol


4. 对特定的文件使用ctags和cscope
   find . -name '*.java' -print > cscope.files
   ctags -L cscope.files(ctags -e -L cscope.files )
   cscope -ub -i cscope.files

5. ctags和cscope在vi中的快捷键

5.1 cscope的快捷键定义可以自己定制,但是网上已经有了定义好的文件:http://cscope.sourceforge.net/cscope_maps.vim
    直接使用就可以了,如果vim是6.0之后的,直接将该文件放在~/vim/plugin/下就可以了。
  ctags: ctrl+T 返回; ctrl+] 到定义
  cscope: ctrl+T 返回; ...

6.你也可以单独使用cscope,使用方法是:  cscope -d yoursymbol


refs:http://softsmith.blogspot.com/2009/01/vim-cscope-trace.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值