0 所有插件的安装都是/usr/share/vim/vim/vim73/ 下的plugin syntax和doc
1 ctags
Linux 自带,或者从官方网站上获取
程序中的所有函数创建索引,每个函数对应一个列表,在列表中列出函数在程序中的调用位置。
一般的使用命令都是ctags –R -c++-kinds=+px –fields=+aiKSz
详细参考http://blog.csdn.net/alexdboy/article/details/3871707
2 cflow
Linux自带,或者从官方网站上获取
cflow打印出一个函数调用树,按照函数之间的正向调用顺序来显示函数之间的调用关系,可以清楚的看到一个程序的框架结构,了解他的操作流程。
一般命令是cflow a.cpp
3 cscope
号称加强版ctags, 个人感觉命令繁琐,不好用
详见:http://blog.csdn.net/longxin007/article/details/1876564
4 a.vim
源文件与头文件切换
有了NERDTree,就没什么作用了
5 NERDTree
列出路径下所有文件,并实现跳转,非常赞!
:NERDTree
6 tagbar
列出所有文件中函数与变量!
:TagbarOpen
7 tabbar
实现Alt + 1-9 之间标签跳转
8 ACK
在vim中绑定perl 的ACK实现,加强版grep
话说这个网站名字叫http://betterthangrep.com/,是不是让grep赶脚压力很大!哈哈
主要参考了这篇文章:
http://lovemaple.info/blog/2011/12/code-reading-with-vim/
Index
1.plugins
- nerdtree - (right window)The NERD tree allows you to explore your filesystem and to open files and directories. It presents the filesystem to you in the form of a tree which you manipulate with the keyboard and/or mouse. It also allows you to perform simple filesystem operations.
- tabbar - (upward side of the middle window)Display the modifiable buffer as tabs. Key-bindings for buffer switching:
- tagbar - (left window)Browsing the tags of source code files. It provides a sidebar that displays the ctags-generated tags of the current file, ordered by their scope.
- ack-vim - (downward of the whole window)This plugin is a front for the Perl module App::Ack. Ack can be used as a replacement for 99% of the uses of grep. This plugin will allow you to run ack from vim, and shows the results in a split window.
2.Shortcuts
C-t - goto definition of the funcions
C-] - go back to where you come from
gd - goto definition of a local viriable
gD - goto definition of a globle viriable
C-i/C-o - goto forward/backward of the check points
#/* - next/previous same word under cursor
In order to use C-t and C-], you must have ctags
intalled first:
yaoort -S ctags
# ArchLinux
sudo
apt-get
install
ctags
# debian/ubuntu
Then, run the command at destination directory where the source codes are located:
ctags –r