@@ -3,16 +3,26 @@ if exists("g:go_loaded_commands")
33endif
44let g: go_loaded_commands = 1
55
6+ " go_jump_to_error defines whether we should pass the bang attribute to the
7+ " command or not. This is only used for mappings, because the user can't pass
8+ " the bang attribute to the plug mappings below. So instead of hardcoding it
9+ " as 0 (no '!' attribute) or 1 (with '!' attribute) we pass the user setting,
10+ " which by default is enabled. For commands the user has the ability to pass
11+ " the '!', such as :GoBuild or :GoBuild!
12+ if ! exists (" g:go_jump_to_error" )
13+ let g: go_jump_to_error = 1
14+ endif
15+
616
717" Some handy plug mappings
8- nnoremap <silent> <Plug> (go-run) :<C-u> call go#cmd#Run(0 ,expand('%'))<CR>
9- nnoremap <silent> <Plug> (go-build) :<C-u> call go#cmd#Build(0 ,'')<CR>
10- nnoremap <silent> <Plug> (go-install) :<C-u> call go#cmd#Install(0 )<CR>
11- nnoremap <silent> <Plug> (go-test) :<C-u> call go#cmd#Test(0 , 0, '')<CR>
12- nnoremap <silent> <Plug> (go-test-func) :<C-u> call go#cmd#TestFunc(0 , '')<CR>
13- nnoremap <silent> <Plug> (go-test-compile) :<C-u> call go#cmd#Test(0 , 1, '')<CR>
14- nnoremap <silent> <Plug> (go-coverage) :<C-u> call go#cmd#Coverage(0 , '')<CR>
15- nnoremap <silent> <Plug> (go-vet) :<C-u> call go#cmd#Vet(0 )<CR>
18+ nnoremap <silent> <Plug> (go-run) :<C-u> call go#cmd#Run(!g:go_jump_to_error ,expand('%'))<CR>
19+ nnoremap <silent> <Plug> (go-build) :<C-u> call go#cmd#Build(!g:go_jump_to_error ,'')<CR>
20+ nnoremap <silent> <Plug> (go-install) :<C-u> call go#cmd#Install(!g:go_jump_to_error )<CR>
21+ nnoremap <silent> <Plug> (go-test) :<C-u> call go#cmd#Test(!g:go_jump_to_error , 0, '')<CR>
22+ nnoremap <silent> <Plug> (go-test-func) :<C-u> call go#cmd#TestFunc(!g:go_jump_to_error , '')<CR>
23+ nnoremap <silent> <Plug> (go-test-compile) :<C-u> call go#cmd#Test(!g:go_jump_to_error , 1, '')<CR>
24+ nnoremap <silent> <Plug> (go-coverage) :<C-u> call go#cmd#Coverage(!g:go_jump_to_error , '')<CR>
25+ nnoremap <silent> <Plug> (go-vet) :<C-u> call go#cmd#Vet(!g:go_jump_to_error )<CR>
1626
1727nnoremap <silent> <Plug> (go-files) :<C-u> call go#tool#Files()<CR>
1828nnoremap <silent> <Plug> (go-deps) :<C-u> call go#tool#Deps()<CR>
0 commit comments