Linux下编程辅助工具vim+ctags+taglist+cppcomplete+cscope+global
来源:互联网 发布:远程桌面后无法登陆sql 编辑:程序博客网 时间:2024/05/21 19:44
各个工具的主要功能:
vim:这个是Linux下功能十分强大的编辑器,就不说了。
ctags:生成tag文件的命令,这个是其它工具的基础。
taglist:需要ctags的支撑,直接在左边列出函数列表,全局参数列表。
cppcomplete:需要ctags的支撑,可以补全类型或者函数名。
cscope:比较强大,可以对函数以及部分类型定义进行跳转,其实cscope是用来替代ctags功能的。
global:貌似和cscope,taglist功能一样,据说对于大型的工程表现不错。
各个工具的安装:
1)vim,ctags,cscope,global,在系统安装时安装,或者使用yum安装。
2)从下面地址下载vim的cscope插件,并放到相应目录下,如~/.vim/plugin/
http://cscope.sourceforge.net/cscope_vim_tutorial.html
2)taglist,cppcomplete是Vim的插件,从下面地址获得,然后放到vim相应目录下即可。
http://www.vim.org/scripts/script.php?script_id=273
http://www.vim.org/scripts/script.php?script_id=527
各个工具的使用:
1)ctags的使用
在终端运行如下命令,将生成文件tags:
ctags *.cpp
要生成cppcomplete需要的tags文件的话,需要运行下面的命令:
ctags -n -f cppcomplete.tags --fields=+ai --C++-types=+p * -L cscope.files
注意,我在最后使用了参数"-L cscope.files" 这仅仅是借用拉cscope生成的文件索引来帮助ctags去查询相关工程文件生成tags。
2)使用taglist
taglist的功能是即时生成当前文件的函数列表和全局变量列表,便于索引。
在vim中命令模式下使用:
Tlist 打开或者关闭当前文件的索引;
TlistSync 立即在打开的索引窗口中定位当前的光标所在位置属于哪个函数或者结构定义中。
3)使用cppcomplete
使用很简单,就是在你需要补全类型成员时,按F8键就可以啦。
The default key mapping to complete the code are:
Alt+l in insert mode will try to find the possible completions and display them in a popup menu. Also normal completions to the names in cppcomplete.tags.
Alt+j in insert mode will show the popup menu with the last results. Selecting one of the items will paste the text.
F8/F9 will work in a similar way as Ctrl+N, Ctrl+P in unextended vim so the script can be used without the popup menu.
F5 in insert mode will lookup the class and display it in a preview window
The key mapping are only tested under Windows and linux and they will not work on all platforms. Changing the mappings is easy.
4)使用cscope
cscope的tag生成最简单的方法是:
在你的开发工程的最上层目录执行cscope-indexer,它会遍历下面的所有目录,生成两个文件,一个是cscope.files,这个文件记录需要生成tags的文件名,可以手工修改,另一个是cscope格式的tags文件cscope.out。
完成后,就可以使用Ctrl-]跳转查找类型定义了。
5)使用global
在工程的最上层目录执行命令:
gtags
等待它完成所有需要的global自己格式的tags的生成。生成完后,可以用如下命令查询相关类型引用和关联关系:
代码:
Gtags xxxx 查找xxxx的定义
Gtags -r xxxx 查找xxxx的引用
Gtags -s xxxx 查找xxxx出现的地方
有时它无法正常分析的类型 可以试试用带-s 的参数的方式找找类型定义。
vim:这个是Linux下功能十分强大的编辑器,就不说了。
ctags:生成tag文件的命令,这个是其它工具的基础。
taglist:需要ctags的支撑,直接在左边列出函数列表,全局参数列表。
cppcomplete:需要ctags的支撑,可以补全类型或者函数名。
cscope:比较强大,可以对函数以及部分类型定义进行跳转,其实cscope是用来替代ctags功能的。
global:貌似和cscope,taglist功能一样,据说对于大型的工程表现不错。
各个工具的安装:
1)vim,ctags,cscope,global,在系统安装时安装,或者使用yum安装。
2)从下面地址下载vim的cscope插件,并放到相应目录下,如~/.vim/plugin/
http://cscope.sourceforge.net/cscope_vim_tutorial.html
2)taglist,cppcomplete是Vim的插件,从下面地址获得,然后放到vim相应目录下即可。
http://www.vim.org/scripts/script.php?script_id=273
http://www.vim.org/scripts/script.php?script_id=527
各个工具的使用:
1)ctags的使用
在终端运行如下命令,将生成文件tags:
ctags *.cpp
要生成cppcomplete需要的tags文件的话,需要运行下面的命令:
ctags -n -f cppcomplete.tags --fields=+ai --C++-types=+p * -L cscope.files
注意,我在最后使用了参数"-L cscope.files" 这仅仅是借用拉cscope生成的文件索引来帮助ctags去查询相关工程文件生成tags。
2)使用taglist
taglist的功能是即时生成当前文件的函数列表和全局变量列表,便于索引。
在vim中命令模式下使用:
Tlist 打开或者关闭当前文件的索引;
TlistSync 立即在打开的索引窗口中定位当前的光标所在位置属于哪个函数或者结构定义中。
3)使用cppcomplete
使用很简单,就是在你需要补全类型成员时,按F8键就可以啦。
The default key mapping to complete the code are:
Alt+l in insert mode will try to find the possible completions and display them in a popup menu. Also normal completions to the names in cppcomplete.tags.
Alt+j in insert mode will show the popup menu with the last results. Selecting one of the items will paste the text.
F8/F9 will work in a similar way as Ctrl+N, Ctrl+P in unextended vim so the script can be used without the popup menu.
F5 in insert mode will lookup the class and display it in a preview window
The key mapping are only tested under Windows and linux and they will not work on all platforms. Changing the mappings is easy.
4)使用cscope
cscope的tag生成最简单的方法是:
在你的开发工程的最上层目录执行cscope-indexer,它会遍历下面的所有目录,生成两个文件,一个是cscope.files,这个文件记录需要生成tags的文件名,可以手工修改,另一个是cscope格式的tags文件cscope.out。
完成后,就可以使用Ctrl-]跳转查找类型定义了。
5)使用global
在工程的最上层目录执行命令:
gtags
等待它完成所有需要的global自己格式的tags的生成。生成完后,可以用如下命令查询相关类型引用和关联关系:
代码:
Gtags xxxx 查找xxxx的定义
Gtags -r xxxx 查找xxxx的引用
Gtags -s xxxx 查找xxxx出现的地方
有时它无法正常分析的类型 可以试试用带-s 的参数的方式找找类型定义。
- Linux下编程辅助工具vim+ctags+taglist+cppcomplete+cscope+global
- Linux下编程辅助工具vim+ctags+taglist+cppcomplete+cscope+global
- 安装linux开发环境(vim + ctags + taglist + cscope + cppcomplete + global )
- vim+ctags+taglist+cscope+cppcomplete+global
- vim+ctags+taglist+cscope+cppcomplete+global
- vim + ctags + taglist + cscope + cppcomplete + global
- vim+ctags+taglist+cscope+cppcomplete+global
- vim+ctags+taglist+cscope+cppcomplete+global:丰富你的VIM
- vim + ctags + taglist + cscope + cppcomplete
- vim + ctags + taglist + cscope + cppcomplete + global 使用初探zz
- vim + ctags + taglist + cscope + cppcomplete + global 使用初探
- vim+ctags+taglist+cscope+cppcomplete+global 环境搭建
- 【vim】安装linux开发环境(vim + ctags + taglist + cscope + cppcomplete + global )
- vim +ctags +taglist +global+cppcomplete 安装
- vim +ctags +taglist +global+cppcomplete 配置
- linux下代码阅读 -- 配置vim+ctags+taglist+cscope[转]
- [转贴]linux下代码阅读 -- 配置vim+ctags+taglist+cscope
- Linux下代码阅读 -- 配置vim+ctags+taglist+cscope[转]
- billboard技术的XNA实现
- Struts+Spring+Hibernate整合入门详解
- 常用网页使用js技巧收集231个
- java访问控制
- 老歌来一首
- Linux下编程辅助工具vim+ctags+taglist+cppcomplete+cscope+global
- 今天收到点歌电话
- 2007.08.12-今天学习到的有关二叉树的知识
- 创建程序菜单和快捷方式的代码
- 重写ejb的helloworld程序,部署容器为JBoss
- 一个有 Reader以及DataSet的DataSource扩展类(原创)
- Internationalization testing
- 封装一个TreeView(原创)
- Servlet 简介