1.git(用来下载vim和相关插件)
sudo apt-get install git
2,cmake(用来编译clang-llvm)
sudo apt-get install build-essential cmake
3.vim,这里手动编译vim,因为需要python支持,直接apt-get的话会遇到很多麻烦
过程参考 https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source
先安装依赖项,注意,Ubuntu 16.04是 `liblua5.1-dev`而不是 `lua5.1-dev`
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
ibgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \
python3-dev ruby-dev lua5.1 liblua5.1-dev libperl-dev git
4.验证安装
vim --version
查找到python,前面有加号即支持python
python3
注意:虽然 vim --version | grep python
显示的python前面确实是加号, 但没有针对Ubuntu 16.04更改配置,导致vim支持还是没有安装。
所以个人认为。如果已经有vim的话还是移除它,重新安装
4.1移除:
sudo apt-get remove vim vim-runtime gvim
sudo apt-get remove vim-tiny vim-common vim-gui-common vim-nox
4.2配置:
cd ~
git clone https://github.com/vim/vim.git
cd vim
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64_linux-gnu \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-gui=gtk2 --enable-cscope --prefix=/usr
make VIMRUNTIMEDIR=/usr/share/vim/vim81
4.3安装:
cd ~/vim
sudo make install
安装成功后,打开vim,命令模式下输入 :echo has("python") || has("python3")
,结果是1就代表成功了。
4.4如果卸载的话相反的,需要保留vim文件夹并且安装checkinstall
sudo apt-get install checkinstall
cd ~/vim
sudo checkinstall
5.安装Vundle(用来管理vim插件)(类似于Python的pip)
5.1.安装:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
5.2.创建并配置.vimrc配置文件
将配置文件添加到你的用户的home文件夹中:
sudo vim ~/vimrc
添加如下内容(大佬配置一):
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 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}
" 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 - lists configured plugins
" :PluginInstall - in