if exists("g:go_loaded_commands") finish endif let g:go_loaded_commands = 1 " go_jump_to_error defines whether we should pass the bang attribute to the " command or not. This is only used for mappings, because the user can't pass " the bang attribute to the plug mappings below. So instead of hardcoding it " as 0 (no '!' attribute) or 1 (with '!' attribute) we pass the user setting, " which by default is enabled. For commands the user has the ability to pass " the '!', such as :GoBuild or :GoBuild! if !exists("g:go_jump_to_error") let g:go_jump_to_error = 1 endif " Some handy plug mappings nnoremap (go-run) :call go#cmd#Run(!g:go_jump_to_error,expand('%')) nnoremap (go-build) :call go#cmd#Build(!g:go_jump_to_error,'') nnoremap (go-generate) :call go#cmd#Generate(!g:go_jump_to_error,'') nnoremap (go-install) :call go#cmd#Install(!g:go_jump_to_error) nnoremap (go-test) :call go#cmd#Test(!g:go_jump_to_error, 0, '') nnoremap (go-test-func) :call go#cmd#TestFunc(!g:go_jump_to_error, '') nnoremap (go-test-compile) :call go#cmd#Test(!g:go_jump_to_error, 1, '') nnoremap (go-coverage) :call go#cmd#Coverage(!g:go_jump_to_error, '') nnoremap (go-vet) :call go#cmd#Vet(!g:go_jump_to_error) nnoremap (go-files) :call go#tool#Files() nnoremap (go-deps) :call go#tool#Deps() nnoremap (go-info) :call go#complete#Info() nnoremap (go-import) :call go#import#SwitchImport(1, '', expand('')) nnoremap (go-implements) :call go#oracle#Implements(-1) nnoremap (go-callees) :call go#oracle#Callees(-1) nnoremap (go-callers) :call go#oracle#Callers(-1) nnoremap (go-describe) :call go#oracle#Describe(-1) nnoremap (go-callstack) :call go#oracle#Callstack(-1) nnoremap (go-freevars) :call go#oracle#Freevars(-1) nnoremap (go-channelpeers) :call go#oracle#ChannelPeers(-1) nnoremap (go-referrers) :call go#oracle#Referrers(-1) nnoremap (go-rename) :call go#rename#Rename() nnoremap (go-def) :call go#def#Jump() nnoremap (go-def-vertical) :call go#def#JumpMode("vsplit") nnoremap (go-def-split) :call go#def#JumpMode("split") nnoremap (go-def-tab) :call go#def#JumpMode("tab") nnoremap (go-doc) :call go#doc#Open("new", "split") nnoremap (go-doc-tab) :call go#doc#Open("tabnew", "tabe") nnoremap (go-doc-vertical) :call go#doc#Open("vnew", "vsplit") nnoremap (go-doc-split) :call go#doc#Open("new", "split") nnoremap (go-doc-browser) :call go#doc#OpenBrowser() " gorename command! -nargs=? GoRename call go#rename#Rename() " oracle command! -range=% GoImplements call go#oracle#Implements() command! -range=% GoCallees call go#oracle#Callees() command! -range=% GoDescribe call go#oracle#Describe() command! -range=% GoCallers call go#oracle#Callers() command! -range=% GoCallstack call go#oracle#Callstack() command! -range=% GoFreevars call go#oracle#Freevars() command! -range=% GoChannelPeers call go#oracle#ChannelPeers() command! -range=% GoReferrers call go#oracle#Referrers() command! -nargs=* -complete=customlist,go#package#Complete GoOracleScope call go#oracle#Scope() " tool command! -nargs=0 GoFiles echo go#tool#Files() command! -nargs=0 GoDeps echo go#tool#Deps() command! -nargs=* GoInfo call go#complete#Info() " cmd command! -nargs=* -bang GoBuild call go#cmd#Build(0,) command! -nargs=* -bang GoGenerate call go#cmd#Generate(0,) command! -nargs=* -bang GoRun call go#cmd#Run(0,) command! -nargs=* -bang GoInstall call go#cmd#Install(0, ) command! -nargs=* -bang GoTest call go#cmd#Test(0, 0, ) command! -nargs=* -bang GoTestFunc call go#cmd#TestFunc(0, ) command! -nargs=* -bang GoTestCompile call go#cmd#Test(0, 1, ) command! -nargs=* -bang GoCoverage call go#cmd#Coverage(0, ) command! -nargs=0 -bang GoVet call go#cmd#Vet(0) " -- play command! -nargs=0 -range=% GoPlay call go#play#Share(, , ) " -- def command! -nargs=* -range GoDef :call go#def#Jump() " -- doc command! -nargs=* -range -complete=customlist,go#package#Complete GoDoc call go#doc#Open('new', 'split', ) command! -nargs=* -range -complete=customlist,go#package#Complete GoDocBrowser call go#doc#OpenBrowser() " -- fmt command! -nargs=0 GoFmt call go#fmt#Format(-1) command! -nargs=0 GoImports call go#fmt#Format(1) " -- import command! -nargs=? -complete=customlist,go#package#Complete GoDrop call go#import#SwitchImport(0, '', ) command! -nargs=1 -complete=customlist,go#package#Complete GoImport call go#import#SwitchImport(1, '', ) command! -nargs=* -complete=customlist,go#package#Complete GoImportAs call go#import#SwitchImport(1, ) " -- lint command! GoLint call go#lint#Run() " -- errcheck command! -nargs=? -complete=customlist,go#package#Complete GoErrCheck call go#errcheck#Run() " vim:ts=4:sw=4:et