fedora 22 : Vim & cscope & ctags 简易使用

1. 软件包:

vim-common.x86_64            2:7.4.827-1.fc22         @System
vim-enhanced.x86_64          2:7.4.827-1.fc22         @updates
vim-filesystem.x86_64        2:7.4.827-1.fc22         @System
vim-minimal.x86_64           2:7.4.827-1.fc22         @System
ctags.x86_64                 5.8-16.fc22              @fedora
cscope.x86_64                15.8-11.fc22             @fedora


2. 使用

2.1 生成必要文件

$ find . -name "*.h" -o -name "*.c" -o -name "*.cc" -o "*.cpp" > cscope.files

$ cscope -bkq -i cscope.files

$ ctags -R

-rw-rw-r--. 1 May May 112104 Jan 11 12:22 cscope.po.out
-rw-rw-r--. 1 May May  61082 Jan 11 12:22 cscope.out
-rw-rw-r--. 1 May May  57344 Jan 11 12:22 cscope.in.out
-rw-rw-r--. 1 May May  28764 Jan 11 12:22 tags

2.2 搜索使用

在vi命令模式输入:cscope help查看cscope简要

add  : Add a new database             (Usage: add file|dir [pre-path] [flags])
find : Query for a pattern            (Usage: find c|d|e|f|g|i|s|t name)
       c: Find functions calling this function
       d: Find functions called by this function
       e: Find this egrep pattern
       f: Find this file
       g: Find this definition
       i: Find files #including this file
       s: Find this C symbol
       t: Find this text string
help : Show this message              (Usage: help)
kill : Kill a connection              (Usage: kill #)
reset: Reinit all connections         (Usage: reset)
show : Show connections               (Usage: show)

在vi命令模式输入cscope find gf main 在当前打开的文件查找main有关定义(命令可能的简写:cs f gf main)

cscope show 查看使用的数据库文件,如果没有对应的文件,使用cscope add namefile 加载进来

参考http://www.cnblogs.com/itech/archive/2012/03/23/2414145.html等


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值