-
Notifications
You must be signed in to change notification settings - Fork 0
vim go setup
keith6014 edited this page May 14, 2019
·
20 revisions
To get language omni support
c-x c-o
To see messages in vim
:messages- vim-8.1
- golang 1.11.2
export GOPATH="$HOME/git/go"
export GOBIN="$GOPATH/bin"- 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
let g:go_fmt_command = "goimports"
"autocmd FileType go nmap <F5> <Plug>(go-run)
"autocmd FileType go nmap <F5> <Plug>(go-run)
autocmd FileType go nmap <leader>r :GoRun<CR>
autocmd FileType python nmap <leader>r :echo system('python2 "' . expand('%') . '"')<cr>#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