Go言語:vim環境設定メモ

Go環境でvimの環境を設定しました。

■NeoBundleをインストール

$ curl https://raw.githubusercontent.com/Shougo/neobundle.vim/master/bin/install.sh > install.sh
$ sh ./install.sh
/home/kumakake/.vim/bundle/neobundle.vim
/home/kumakake/.config/nvim/bundle/neobundle.vim
git is /usr/bin/git
Begin fetching NeoBundle…
Initialized empty Git repository in /home/kumakake/.vim/bundle/neobundle.vim/.git/
remote: Counting objects: 9222, done.
remote: Total 9222 (delta 0), reused 0 (delta 0), pack-reused 9222
Receiving objects: 100% (9222/9222), 2.26 MiB | 1.67 MiB/s, done.
Resolving deltas: 100% (4470/4470), done.
Done.
Please add the following settings for NeoBundle to the top of your .vimrc file:
“NeoBundle Scripts—————————–
if &compatible
set nocompatible ” Be iMproved
endif

” Required:
set runtimepath+=/home/kumakake/.vim/bundle/neobundle.vim/

” Required:
call neobundle#begin(expand(‘/home/kumakake/.vim/bundle’))

” Let NeoBundle manage NeoBundle
” Required:
NeoBundleFetch ‘Shougo/neobundle.vim’

” Add or remove your Bundles here:
NeoBundle ‘Shougo/neosnippet.vim’
NeoBundle ‘Shougo/neosnippet-snippets’
NeoBundle ‘tpope/vim-fugitive’
NeoBundle ‘ctrlpvim/ctrlp.vim’
NeoBundle ‘flazz/vim-colorschemes’

” You can specify revision/branch/tag.
NeoBundle ‘Shougo/vimshell’, { ‘rev’ : ‘3787e5’ }

” Required:
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
“End NeoBundle Scripts————————-
Done.
Complete setup NeoBundle!

$ vim .vimrc
上のスクリプトを挿入する
vimを終了する

$vim
Not installed bundles: [‘メモ忘れたorz’]
Install bundles now?
(y)es, [N]o:

yを入力する
⇒更新中は何も動きなし(^^;

完了後 :q で終了する

.vimrcに下記を追加する
NeoBundle ‘fatih/vim-go’

※追加場所は
NeoBundle ‘Shougo/vimshell’, { ‘rev’ : ‘3787e5’ }
の下に入れた。

再度、vimを起動する
Not installed bundles: [‘vim-go’]
Install bundles now?
(y)es, [N]o:

yを入力する
⇒更新中は何も動きなし(^^;

完了後 :q で終了する

vimを起動する
“:GoInstallBinaries”を入力する
vim-go: gocode not found. Installing github.com/nsf/gocode to folder /home/kumakake/go/bin/
vim-go: gometalinter not found. Installing github.com/alecthomas/gometalinter to folder /home/kumakake/go/bin/
vim-go: goimports not found. Installing golang.org/x/tools/cmd/goimports to folder /home/kumakake/go/bin/
vim-go: guru not found. Installing golang.org/x/tools/cmd/guru to folder /home/kumakake/go/bin/
vim-go: gorename not found. Installing golang.org/x/tools/cmd/gorename to folder /home/kumakake/go/bin/
vim-go: golint not found. Installing github.com/golang/lint/golint to folder /home/kumakake/go/bin/
vim-go: godef not found. Installing github.com/rogpeppe/godef to folder /home/kumakake/go/bin/
vim-go: errcheck not found. Installing github.com/kisielk/errcheck to folder /home/kumakake/go/bin/
vim-go: gotags not found. Installing github.com/jstemmer/gotags to folder /home/kumakake/go/bin/
vim-go: asmfmt not found. Installing github.com/klauspost/asmfmt/cmd/asmfmt to folder /home/kumakake/go/bin/
vim-go: motion not found. Installing github.com/fatih/motion to folder /home/kumakake/go/bin/
vim-go: gomodifytags not found. Installing github.com/fatih/gomodifytags to folder /home/kumakake/go/bin/
vim-go: gogetdoc not found. Installing github.com/zmb3/gogetdoc to folder /home/kumakake/go/bin/
vim-go: impl not found. Installing github.com/josharian/impl to folder /home/kumakake/go/bin/
vim-go: keyify not found. Installing github.com/dominikh/go-tools/cmd/keyify to folder /home/kumakake/go/bin/
Press ENTER or type command to continue

・main関数内で「fmt.」と入力し、そのままcontrolキーを押しながら、x, oと入力すると、入力補完が起動
・”:GoRun”で実行する
—–
package main

import “fmt”

func main(){
fmt.Printf(“Hello World\n”)
}

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です