" Go vim settings if exists('b:did_ftplugin') unlet b:did_ftplugin endif compiler go " Compile package nnoremap cc :make " Compile file nnoremap cd :make % " Compile & run file nnoremap cr :!go run % " Format nnoremap cdf :!go fmt % " Comment string setlocal commentstring=//\ %s " Continue comments on and `o` `O`. setlocal formatoptions+=or " Add a trailing comma when expanding elements to multiple lines let b:argwrap_tail_comma = 1 nmap Zr :GoRun . nmap Zb (go-build) nmap Zc (go-test-compile) nmap Zf (go-imports) nmap z (go-test) nmap Z (go-test-func) nnoremap Zs :execute '!go test -v ' . fnameescape(expand('%:p:h')) nmap z :call go#alternate#Switch(1, 'edit') nmap z :call go#alternate#Switch(1, 'vsplit') nmap Ze (go-iferr) command! -buffer -nargs=? GoDoc call s:GoDoc() if exists('*s:GoDoc') finish endif function! s:GoDoc(search_term) let search_term = a:search_term if search_term == '' let search_term = expand('') endif new execute 'read !go doc -all ' . shellescape(search_term) 1delete 1 set readonly nomodified setfiletype godoc endfunction