這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。
分兩步:
第一步:安裝vim外掛程式管理器Vundle
第二步:安裝vim-go外掛程式。
另外:我也寫了一個自動安裝的指令碼。手懶的朋友,可以自行下載使用:https://github.com/aimin/InstallvimGo.git
---------------------------------------------------------------------------------------
開始:
第一步:安裝Vundle
根據Vundle的安裝說明,首先安裝Vundle:
$ git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
然後對.vimrc進行配置,將Vundle的相關配置置在最開始處,下面只顯示關於Vundle的相關配置:
對.vimrc進行配置,將Vundle的相關配置置在最開始處,下面只顯示關於Vundle的相關配置(詳細參考Vundle的README.MD):
- " -------------
- " Vundle
- " https://github.com/gmarik/Vundle.vim
- " -------------
-
- 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'
-
- " 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/'}
- " Avoid a name conflict with L9
- ""Plugin 'user/L9', {'name': 'newL9'}
-
- " Install Vim-go
- Plugin 'fatih/vim-go'
-
- " 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 - installs plugins; append `!` to update or just :PluginUpdate
- " :PluginSearch foo - searches for foo; append `!` to refresh local cache
- " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
- "
- " see :h vundle for more details or wiki for FAQ
- " Put your non-Plugin stuff after this line
第二步:安裝vim-go (詳細查看vim-go的README.MD)
git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go 注意路徑
在上述~/.vimrc裡增加下面一行。
Plugin 'fatih/vim-go'
至此安裝完成。
開啟.go 檔案看看效果吧!