ctags 、 cscope vim

来源:互联网 发布:3.35 魔兽数据库 编辑:程序博客网 时间:2024/06/06 03:55

一。ctags

1.安装ctags 

2.在source 目录下执行 ctags -R,会生成一个tags 文件

3.在.vimrc 中加入 set tags=/xxx/xx/tags

此时在vim 中就可 使用名 :tag symbol 


tag 用法

  Ctrl+ ]跳到光标所在函数或者结构体的定义处 

  Ctrl+ T返回查找或跳转

 :ts xxx 列出包含xxx 的文件供选择。


二cs

1.安装csope

2.在source 目录下执行 cscope -Rbkq 生成一些文件【 cscope.in.out  cscope.out  cscope.po.out】

3.在 .vimrc 中加入copecs add  /home/xxxx/cscope.out /home/xxx/

此时可以在vim 中使用 cs 命令

cs help 

:

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 assignments to
help : Show this message              (Usage: help)
kill : Kill a connection              (Usage: kill #)
reset: Reinit all connections         (Usage: reset)
show : Show connections               (Usage: show)

我只使用过 cs find 

ctags + cscope 可以让我们在vim 中轻松阅读代码。


 


原创粉丝点击