之前在百度实习的时候,用的开发环境vim+ctags+taglist,感觉挺好用的。所以今天自己回家装一个用用。
1.ctags安装: ctags可以让你的vim从函数声明,直接跳转到函数定义,而不用从vim重新打开cpp
a)源码 : http://ctags.sourceforge.net/
b) su进入root用户
c)解压后进入目录 ./configure , make , make install
d)一路稀里哗啦后,再设置一个快捷健,可以实时更新你的tag,在 /etc/vimrc文件下添加 map <C-F12> :!ctags -R * .<CR>
d)最主要的两个快捷键:ctr+】 和 ctr+t.一个是进入函数,一个是返回上层函数
2.taglist安装: 可以让你的一个cpp里的函数定义以一个列表显示到你的vim上。
具体安装和使用看官网这个吧
0.download linker http://ctags.sourceforge.net/
- For taglist version 3.1 and above
Download the taglist.zip file and unzip the files to the $HOME/.vim or the $HOME/vimfiles or the $VIM/vimfiles directory. This should unzip the following two files (the directory structure should be preserved):plugin/taglist.vim - main taglist plugin file doc/taglist.txt - documentation (help) file
For taglist version 3.0 and below
Copy the taglist.vim plugin file to the $HOME/.vim/plugin directory.Refer to the 'add-plugin', 'add-global-plugin' and 'runtimepath' Vim help pages for more details about installing Vim plugins.
- Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or $VIM/vimfiles/doc directory, start Vim and run the ":helptags ." command to process the taglist help file. Without this step, you cannot jump to the taglist help topics.
- If the exuberant ctags utility is not present in your PATH, then set the Tlist_Ctags_Cmd variable to point to the location of the exuberant ctags utility (not to the directory) in the .vimrc file.
- If you are running a terminal/console version of Vim and the terminal doesn't support changing the window width then set the 'Tlist_Inc_Winwidth' variable to 0 in the .vimrc file.
- Restart Vim.
- You can now use the ":TlistToggle" command (previously ":Tlist") to open/close the taglist window. You can use the ":help taglist" command to get more information about using the taglist plugin.
3. clang_complete,代码补全
编辑器么起码要有代码补齐功能,不然vs+VA就可以虐vim了。现在vim上也有
a)yum install clang (我用的fedora)ubuntu用户自己安装clang
b)从http://www.vim.org/scripts/script.php?script_id=3302&rating=life_changing 上下载一个vmb,一般我用最新的.
c)If you have installed vimscript #1520, please remove it, as it is confliting with this one.
d)To install: vim clang_complete.vmb -c 'so %' -c 'q'具体安装就这一条命令就可以了。