Update vim

This commit is contained in:
vCaesar
2016-12-22 03:01:40 +08:00
parent 3310ee5b9b
commit 2c723b4812

View File

@@ -310,10 +310,66 @@ Gogland是JetBrains公司推出的Go语言集成开发环境是Idea Go插件
## Vim
Vim是从vi发展出来的一个文本编辑器, 代码补全、编译及错误跳转等方便编程的功能特别丰富,在程序员中被广泛使用。
vim-go是vim上面的一款开源的go语言使用最为广泛开发环境的的插件
插件地址:[github.com/fatih/vim-go](https://github.com/fatih/vim-go)
vim的插件管理主要有[Pathogen](https://github.com/tpope/vim-pathogen)与[Vundle](https://github.com/VundleVim/Vundle.vim)
,但是其作用的方面不同。
pathogen是为了解决每一个插件安装后文件分散到多个目录不好管理而存在的。vundle是为了解决自动搜索及下载插件而存在的。
这两个插件可同时使用。
1.安装Vundle
```sh
mkdir ~/.vim/bundle
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
```
修改.vimrc将Vundle的相关配置置在最开始处([详细参考Vundle的介绍文档](https://github.com/VundleVim/Vundle.vim))
```sh
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'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
```
2.安装Vim-go
修改~/.vimrc在vundle#begin和vundle#end间增加一行
```sh
Plugin 'fatih/vim-go'
```
在Vim内执行: PluginInstall
3.安装YCM(Your Complete Me)进行自动补全
在~/.vimrc中添加一行
```sh
Plugin 'Valloric/YouCompleteMe'
```
在Vim内执行: PluginInstall
![](images/1.4.vim.png?raw=true)
图1.9 VIM编辑器自动化提示Go界面
接着我们继续配置vim:
1. 配置vim高亮显示
cp -r $GOROOT/misc/vim/* ~/.vim/