
gVim安装安装只需一个命令:
sudo apt-get install vim-gtk
下面重点讲插件的安装和配置。
要安装的插件包括:
nerdtree:文件和目录浏览。
ctrlp.vim: 代码和文件模糊查找。
syntastic:支持各种语言的语法检查。
fugitive:git集成。
PIV: PHP集成环境,自动产生PHP文档,Shift+K查看PHP函数文档。
tagbar:函数列表。
ultisnips:提供代码模板功能,但不包含各语言的代码模板。
vim-snippets:提供各种语言的ultisnips的代码模板。
youcompleteme:无处不在的自动补齐
supertab:让ultisnips与youcompleteme协同工作
vim-airline:强大的状态栏。
echofunc:了解函数参数。
vim-twig:Twig模板支持。
vim-css-color:所见及所得的CSS颜色。
vdebug:PHP、Python等可视化调试。
vim-gitgutter:显示文件每一行的修改状态。
通过apt-get安装Ubuntu提供的插件:
Ubuntu已经提供了youcompleteme等插件,可以直接安装:
$ sudo apt-get install vim-youcompleteme
$ vim-addons install youcompleteme
安装matchit插件:
$ vim-addons install matchit
Ubuntu15.04已经提供了fugitive和syntastic等插件,可以直接安装:
$ sudo apt-get install vim-fugitive vim-syntastic vim-ctrlp vim-ultisnips vim-snippets
$ vim-addons install ctrlp
(对于Ubuntu15.04以前的版本,这些插件只能通过Vundle安装)
tagbar要用到ctags,需要先安装:
$ sudo apt-get install exuberant-ctags
其他插件需要通过Vundle安装,先安装Vundle:
mkdir ~/.vim/bundle
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
编辑~/.vimrc配置Vundle:
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'spf13/PIV' " PHP Integration environment
Plugin 'majutsushi/tagbar'
Plugin 'bling/vim-airline' " Status line
Plugin 'mbbill/echofunc'
Plugin 'evidens/vim-twig'
Plugin 'ap/vim-css-color'
Plugin 'airblade/vim-gitgutter' " Git status for each line
Plugin 'joonty/vdebug' " DBGP debugger
Plugin 'ervandew/supertab'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - list configured plugins
" :PluginInstall(!) - install (update) plugins
" :PluginSearch(!) foo - search (or refresh cache first) for foo
" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
如果是Ubuntu 15.04以前的版本,这些插件也需要通过Vundle安装:
Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-fugitive' " Git wrapper
Plugin 'kien/ctrlp.vim'" Fuzzy file, buffer, mru, tag, etc finder.
Plugin 'sirver/ultisnips'
Plugin 'honza/vim-snippets'" Snippets for snipmate
然后重新启动gVim并运行:
:PluginInstall
完成插件的最后安装