mappings.vim 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. " go_jump_to_error defines whether we should pass the bang attribute to the
  2. " command or not. This is only used for mappings, because the user can't pass
  3. " the bang attribute to the plug mappings below. So instead of hardcoding it
  4. " as 0 (no '!' attribute) or 1 (with '!' attribute) we pass the user setting,
  5. " which by default is enabled. For commands the user has the ability to pass
  6. " the '!', such as :GoBuild or :GoBuild!
  7. if !exists("g:go_jump_to_error")
  8. let g:go_jump_to_error = 1
  9. endif
  10. " Some handy plug mappings
  11. nnoremap <silent> <Plug>(go-run) :<C-u>call go#cmd#Run(!g:go_jump_to_error)<CR>
  12. if has("nvim")
  13. nnoremap <silent> <Plug>(go-run-vertical) :<C-u>call go#cmd#RunTerm(!g:go_jump_to_error, 'vsplit', [])<CR>
  14. nnoremap <silent> <Plug>(go-run-split) :<C-u>call go#cmd#RunTerm(!g:go_jump_to_error, 'split', [])<CR>
  15. nnoremap <silent> <Plug>(go-run-tab) :<C-u>call go#cmd#RunTerm(!g:go_jump_to_error, 'tabe', [])<CR>
  16. endif
  17. nnoremap <silent> <Plug>(go-build) :<C-u>call go#cmd#Build(!g:go_jump_to_error)<CR>
  18. nnoremap <silent> <Plug>(go-generate) :<C-u>call go#cmd#Generate(!g:go_jump_to_error)<CR>
  19. nnoremap <silent> <Plug>(go-install) :<C-u>call go#cmd#Install(!g:go_jump_to_error)<CR>
  20. nnoremap <silent> <Plug>(go-test) :<C-u>call go#test#Test(!g:go_jump_to_error, 0)<CR>
  21. nnoremap <silent> <Plug>(go-test-func) :<C-u>call go#test#Func(!g:go_jump_to_error)<CR>
  22. nnoremap <silent> <Plug>(go-test-compile) :<C-u>call go#test#Test(!g:go_jump_to_error, 1)<CR>
  23. nnoremap <silent> <Plug>(go-coverage) :<C-u>call go#coverage#Buffer(!g:go_jump_to_error)<CR>
  24. nnoremap <silent> <Plug>(go-coverage-clear) :<C-u>call go#coverage#Clear()<CR>
  25. nnoremap <silent> <Plug>(go-coverage-toggle) :<C-u>call go#coverage#BufferToggle(!g:go_jump_to_error)<CR>
  26. nnoremap <silent> <Plug>(go-coverage-browser) :<C-u>call go#coverage#Browser(!g:go_jump_to_error)<CR>
  27. nnoremap <silent> <Plug>(go-files) :<C-u>call go#tool#Files()<CR>
  28. nnoremap <silent> <Plug>(go-deps) :<C-u>call go#tool#Deps()<CR>
  29. nnoremap <silent> <Plug>(go-info) :<C-u>call go#tool#Info(0)<CR>
  30. nnoremap <silent> <Plug>(go-import) :<C-u>call go#import#SwitchImport(1, '', expand('<cword>'), '')<CR>
  31. nnoremap <silent> <Plug>(go-imports) :<C-u>call go#fmt#Format(1)<CR>
  32. nnoremap <silent> <Plug>(go-implements) :<C-u>call go#guru#Implements(-1)<CR>
  33. nnoremap <silent> <Plug>(go-callees) :<C-u>call go#guru#Callees(-1)<CR>
  34. nnoremap <silent> <Plug>(go-callers) :<C-u>call go#guru#Callers(-1)<CR>
  35. nnoremap <silent> <Plug>(go-describe) :<C-u>call go#guru#Describe(-1)<CR>
  36. nnoremap <silent> <Plug>(go-callstack) :<C-u>call go#guru#Callstack(-1)<CR>
  37. xnoremap <silent> <Plug>(go-freevars) :<C-u>call go#guru#Freevars(0)<CR>
  38. nnoremap <silent> <Plug>(go-channelpeers) :<C-u>call go#guru#ChannelPeers(-1)<CR>
  39. nnoremap <silent> <Plug>(go-referrers) :<C-u>call go#guru#Referrers(-1)<CR>
  40. nnoremap <silent> <Plug>(go-sameids) :<C-u>call go#guru#SameIds()<CR>
  41. nnoremap <silent> <Plug>(go-whicherrs) :<C-u>call go#guru#Whicherrs(-1)<CR>
  42. nnoremap <silent> <Plug>(go-sameids-toggle) :<C-u>call go#guru#ToggleSameIds()<CR>
  43. nnoremap <silent> <Plug>(go-rename) :<C-u>call go#rename#Rename(!g:go_jump_to_error)<CR>
  44. nnoremap <silent> <Plug>(go-def) :<C-u>call go#def#Jump('')<CR>
  45. nnoremap <silent> <Plug>(go-def-vertical) :<C-u>call go#def#Jump("vsplit")<CR>
  46. nnoremap <silent> <Plug>(go-def-split) :<C-u>call go#def#Jump("split")<CR>
  47. nnoremap <silent> <Plug>(go-def-tab) :<C-u>call go#def#Jump("tab")<CR>
  48. nnoremap <silent> <Plug>(go-def-pop) :<C-u>call go#def#StackPop()<CR>
  49. nnoremap <silent> <Plug>(go-def-stack) :<C-u>call go#def#Stack()<CR>
  50. nnoremap <silent> <Plug>(go-def-stack-clear) :<C-u>call go#def#StackClear()<CR>
  51. nnoremap <silent> <Plug>(go-doc) :<C-u>call go#doc#Open("new", "split")<CR>
  52. nnoremap <silent> <Plug>(go-doc-tab) :<C-u>call go#doc#Open("tabnew", "tabe")<CR>
  53. nnoremap <silent> <Plug>(go-doc-vertical) :<C-u>call go#doc#Open("vnew", "vsplit")<CR>
  54. nnoremap <silent> <Plug>(go-doc-split) :<C-u>call go#doc#Open("new", "split")<CR>
  55. nnoremap <silent> <Plug>(go-doc-browser) :<C-u>call go#doc#OpenBrowser()<CR>
  56. nnoremap <silent> <Plug>(go-metalinter) :<C-u>call go#lint#Gometa(0)<CR>
  57. nnoremap <silent> <Plug>(go-lint) :<C-u>call go#lint#Golint()<CR>
  58. nnoremap <silent> <Plug>(go-vet) :<C-u>call go#lint#Vet(!g:go_jump_to_error)<CR>
  59. nnoremap <silent> <Plug>(go-alternate-edit) :<C-u>call go#alternate#Switch(0, "edit")<CR>
  60. nnoremap <silent> <Plug>(go-alternate-vertical) :<C-u>call go#alternate#Switch(0, "vsplit")<CR>
  61. nnoremap <silent> <Plug>(go-alternate-split) :<C-u>call go#alternate#Switch(0, "split")<CR>
  62. " vim: sw=2 ts=2 et