Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upRadu's vim setup
A quick and dirty for how to get started with vim and go.
1. Install pathogen
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
And add to the top of ~/.vimrc:
execute pathogen#infect()
syntax on
filetype plugin indent on2. Install vim-go
git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go
Add these to ~/.vimrc:
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_build_constraints = 1
autocmd FileType go set number fo+=croq tw=100
autocmd Filetype go set makeprg=go\ build\ .
autocmd Filetype go nmap <C-]> :exec("GoDef")<CR>
autocmd Filetype go nmap <F9> :GoReferrers<CR>
autocmd Filetype go nmap <C-\> <Plug>(go-def-split)
autocmd Filetype go nmap <Space> <Plug>(go-info)Make sure $GOPATH is set correctly, start vim and run
:GoInstallBinaries
Optional: set up ag
Install ag (a faster, better grep) on your system. On Debian:
apt-get install silversearcher-ag
Then install the vim plugin
cd ~/.vim/bundle && git clone https://github.com/rking/ag.vim
Press h to open a hovercard with more details.