共计 1348 个字符,预计需要花费 4 分钟才能阅读完成。
文章目录 [隐藏]
VIM8 发布也很长一段时间了,目前基本趋于稳定,刚好最近也在学习 go,对于 go 的语法支持插件需要 vim8,而我用的 CentOS 6 中 VIM 版本为 7.4, 果断开始折腾。
1、下载 vim8 源码
mkdir /opt/vim8
cd /opt/vim8
git clone https://github.com/vim/vim.git
2、编译 vim8
废话不多说,看操作:
cd /opt/vim8/vim
# 需要 python3 的支持,这里我们安装 epel 源,同时安装 python34 和 ruby 开发包
yum install epel-release -y
yum install python34 python34-devel
# 开始编译 vim
./configure --prefix=/usr/local/vim8 \
--with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib64/python2.6/config \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib64/python3.4/config-3.4m \
--enable-luainterp=yes \
--enable-gui=gtk2 \
--with-ruby-command=$(which ruby) \
--enable-cscope
# 编译
make
# 安装
make install
3、配置 8
治病还是得看操作:
# 添加环境变量至 /etc/profile,最后一行添加
export PATH=/usr/local/vim8/bin:$PATH
# 安装 vundle.vim 插件,用于安装 go 插件
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
添加~/.vimrc 文件,内容如下:
syntax on
set nu
"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()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'fatih/vim-go'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
set softtabstop=4
开始安装插件,命令模式下输入 PluginInstall,即可自动安装完成
3、测试 go 插件
编写一个简单的 hello world,颜色也漂亮了
正文完
扫码赞助
