現在使用中の環境では、.vimrcの内容がゴチャゴチャしているためか、あるいは.vimディレクトリにインストールされたプラグインが干渉しているためか、上手くいかなかった。
そこで、vimおよびGo言語に関するディレクトリ/ファイルを削除し、まっさらな状態から再チャレンジしてみた。
前準備
~/.vimrc、~/.vim、~/goを削除する。
※~/goディレクトリが残っていると、依存性の関係か何かで上手くインストールできないらしい。
NeoBundleのインストール
$ wget https://raw.githubusercontent.com/Shougo/neobundle.vim/master/bin/install.sh $ sh install.sh
~/.vimrcの作成
以下の内容で~/.vimrcを作成する(こちらの内容に4タブ設定などを追加)。
※vim -u NONEでエディタを起動する。
set encoding=utf-8 set fileencodings=iso-2022-jp,euc-jp,sjis,utf-8 set fileformats=unix,dos,mac " Note: Skip initialization for vim-tiny or vim-small. if 0 | endif if &compatible set nocompatible " Be iMproved endif " Required: set runtimepath^=~/.vim/bundle/neobundle.vim/ " Required: call neobundle#begin(expand('~/.vim/bundle/')) " Let NeoBundle manage NeoBundle " Required: NeoBundleFetch 'Shougo/neobundle.vim' " My Bundles here: " Refer to |:NeoBundle-examples|. " Note: You don't set neobundle setting in .gvimrc! NeoBundle 'fatih/vim-go' call neobundle#end() " Required: filetype plugin indent on " If there are uninstalled bundles found on startup, " this will conveniently prompt you to install them. NeoBundleCheck
fatih/vim-goのインストール
vimを起動するとvim-goをインストールするか聞かれるので、Yを押してインストールする。
インストール終了後、いったんvimを終了し、再度立ち上げ以下のコマンドを入力する。
:GoInstallBinaries
ホームディレクトリにgoディレクトリが作成され、その中に何やらインストールされてるっぽい。
「--more--」が表示されたら、Enterを押して先に進める。
残作業
とりあえず、環境変数GOPATHを~/go以外に設定しておいた。
追記
その後、以前の.vimrcの設定を追加したとろこ、またしてもCtrl+x Ctrl+oでオムニ保管ができなくなってしまった。
しかし、vimを起動後、
GoUpdateBinaries
を実行したらちゃんと動いた。
なぜ動いたのかは不明。
こんな細かいところを気にしてたら日が暮れてしまう。
参考サイト
vim-goをインストールしてみた(所要時間:15分)
vim-goの自動補完が効かないときの調べ方