网络安装:greLinux联盟 greLinux联盟 b074@gliethttp:~/work/test/at_parsor2$ sudo apt-get install ctagsgreLinux联盟 greLinux联盟 源码安装greLinux联盟 greLinux联盟 1. 安装ctagsgreLinux联盟 到http://ctags.sourceforge.net下载源码,解压后greLinux联盟 $ ./configuregreLinux联盟 $ makegreLinux联盟 $ sudo make installgreLinux联盟 greLinux联盟 2. 在源码目录下执行greLinux联盟 $ ctags -RgreLinux联盟 "-R"表示递归创建,也就包括源代码根目录下的所有子目录下的源程序,当前目录下会生成tags索引文件。greLinux联盟 假设原来当前源码目录包含以下内容greLinux联盟 ./MakefilegreLinux联盟 ./src #源码存放的文件夹greLinux联盟 执行ctags -R后greLinux联盟 ./MakefilegreLinux联盟 ./src #源码存放的文件夹greLinux联盟 ./tagsgreLinux联盟 "tags"文件中包括这些对象的列表:greLinux联盟 greLinux联盟 用#define定义的宏greLinux联盟 枚举型变量的值greLinux联盟 函数的定义、原型和声明greLinux联盟 名字空间(namespace)greLinux联盟 类型定义(typedefs)greLinux联盟 变量(包括定义和声明)greLinux联盟 类(class)、结构(struct)、枚举类型(enum)和联合(union)greLinux联盟 类、结构和联合中成员变量或函数greLinux联盟 3.vim会通过tags文件中的索引来定位greLinux联盟 在tags文件所在的目录运行vim打开源文件.c或者.hgreLinux联盟 a. 把光标移到要查看的变量或函数的位置,ctrl+]便可以跳转到变量或函数定义的位置,ctrl+o返回.greLinux联盟 b. 光标停在头文件引用的地方,按gf键可跳转到该头文件,ctrl+o返回greLinux联盟 c. 将光标停放在函数或者变量的位置,gd会高亮出当前文件中所有的函数或者变量,按n查看下一个greLinux联盟 d. gg光标返回到文件的顶部greLinux联盟
|