Skip to content

vim go setup

keith6014 edited this page Nov 11, 2018 · 20 revisions

Golang 1.11.2 linux/amd64 modules

Requirements

  • vim-8.1

  • golang 1.11.2

  • Create yourself a .vimrc file which looks like this

" Working .vimrc
call plug#begin()
Plug 'https://github.com/plasticboy/vim-markdown.git', {'tags':'2.0.0'}
Plug 'https://gitlab.com/mcepl/vim-colors-solarized.git', { 'branch': 'pull77-less-drasticSignColumn'}
Plug 'https://github.com/fatih/vim-go.git', { 'do': ':GoInstallBinaries', 'commit': '7abf54e' }
Plug 'https://github.com/visualfc/gocode.git', { 'commit':'dfb212f', 'rtp': 'vim', 'do': '~/.vim/plugged/gocode/vim/symlink.sh' }
call plug#end()

filetype plugin on


set background=dark
let g:solarized_termcolors=256 "this is what fixed it for me
colorscheme solarized
#rm -rf  ~/.vimrc ~/.vim 
#rm -rf $GOPATH; mkdir -p $GOPATH

curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
export GOPATH=~/go/ #need to install Go Depedencies
vim +'PlugInstall' +qall
vim +'GoInstallBinaries' +qall
rm -rf $GOPATH/bin/gocode
go get -u github.com/visualfc/gocode && unset GOPATH
killall gocode -9; rm -rf /tmp/gocode-daemon*
#use this as a template. https://github.com/keith6014/go/tree/master/cmd_project_template
# it tests standard modules (fmt), externals (kingpin), and locally created modules
rm -rf go.sum go.mod 
unset GOPATH
go mod init local
go build cmd/mytool/main.go

Clone this wiki locally