2021-03-18 08:05:37 +00:00
|
|
|
nmap <silent> <leader>gb :up<bar>:GoBuild<cr>
|
|
|
|
nmap <silent> <leader>gr :up<bar>:GoRun<cr>
|
2021-03-23 06:46:31 +00:00
|
|
|
nmap <silent> <leader>gt :up<bar>:GoTest!<cr>
|
|
|
|
nmap <silent> <leader>gT :up<bar>:GoTest<cr>
|
|
|
|
nmap <silent> <leader>gf :up<bar>:GoTestFunc!<cr>
|
|
|
|
nmap <silent> <leader>gF :up<bar>:GoTestFunc<cr>
|
2021-04-05 19:56:07 +00:00
|
|
|
nmap <silent> <leader>gj :GoDecls<cr>
|
|
|
|
nmap <silent> <leader>gJ :GoDeclsDir<cr>
|
2021-03-21 15:10:17 +00:00
|
|
|
|
2021-03-18 08:05:37 +00:00
|
|
|
nmap <silent> <leader>gk :GoDocBrowser<cr>
|
2021-01-27 14:32:26 +00:00
|
|
|
|
2021-03-18 16:18:38 +00:00
|
|
|
nmap <silent> <leader>gv :vsplit<bar>:GoAlternate!<cr>
|
|
|
|
nmap <silent> <leader>gV <c-w><c-o>:vsplit<bar>:GoAlternate!<cr>
|
|
|
|
nmap <silent> <leader>gs :split<bar>:GoAlternate!<cr>
|
|
|
|
nmap <silent> <leader>gS <c-w><c-o>:split<bar>:GoAlternate!<cr>
|
2021-03-18 08:05:37 +00:00
|
|
|
nmap <silent> <leader>gat <esc>:GoAddTags<cr>
|
|
|
|
nmap <silent> <leader>grt <esc>:GoRemoveTags<cr>
|
|
|
|
nmap <silent> <leader>gec <esc>:up<bar>:GoErrCheck<cr>
|
2021-01-27 19:17:05 +00:00
|
|
|
|
2021-04-19 07:29:13 +00:00
|
|
|
nnoremap <silent> <leader>_ ciw_<esc>b
|
2021-03-26 08:34:54 +00:00
|
|
|
|
2021-01-27 19:17:05 +00:00
|
|
|
nnoremap <silent> dr :GoDebugBreakpoint<cr>
|
|
|
|
nnoremap <silent> d! :GoDebugStart<cr>
|
|
|
|
nnoremap <silent> dc :GoDebugContinue<cr>
|
|
|
|
nnoremap <silent> dq :GoDebugStop<cr>
|
|
|
|
nnoremap <silent> dn :GoDebugNext<cr>
|
|
|
|
nnoremap <silent> ds :GoDebugStep<cr>
|
|
|
|
|
2021-03-21 15:10:17 +00:00
|
|
|
" Vim-Go configuration
|
|
|
|
let g:go_gopls_enabled = 0
|
2021-06-22 04:24:37 +00:00
|
|
|
let g:go_fmt_autosave = 1
|
2021-09-05 21:32:03 +00:00
|
|
|
let g:go_fmt_command = "goimports"
|
2021-03-24 14:19:54 +00:00
|
|
|
let g:go_imports_autosave = 0
|
2021-06-22 04:24:37 +00:00
|
|
|
let g:go_textobj_enabled = 0
|
2021-01-27 19:17:05 +00:00
|
|
|
let g:go_auto_sameids = 0
|
|
|
|
let g:go_auto_type_info = 0
|
2021-03-21 15:10:17 +00:00
|
|
|
let g:go_code_completion_enabled = 0
|
2021-03-18 19:57:37 +00:00
|
|
|
let g:go_echo_command_info = 0
|
2021-03-18 08:05:37 +00:00
|
|
|
let g:go_echo_go_info = 0
|
2021-06-22 04:24:37 +00:00
|
|
|
let g:go_textobj_enabled = 0
|
2021-03-19 07:08:57 +00:00
|
|
|
let g:go_highlight_diagnostic_errors = 0
|
|
|
|
let g:go_highlight_diagnostic_warnings = 0
|
2021-03-24 08:38:55 +00:00
|
|
|
let g:go_highlight_trailing_whitespace_error=0
|
2021-03-21 15:10:17 +00:00
|
|
|
|
2021-10-08 12:30:25 +00:00
|
|
|
let g:go_fmt_command = 'goimports'
|
|
|
|
|
2021-03-21 15:10:17 +00:00
|
|
|
" g:go_statusline_duration doesn't seem to work accurately, but does help
|
|
|
|
" reduce the time the build/test success messages are shown in the status
|
|
|
|
" line.
|
2021-03-18 19:57:37 +00:00
|
|
|
let g:go_statusline_duration = 1000
|
2021-01-28 08:21:55 +00:00
|
|
|
|
2021-01-27 19:17:05 +00:00
|
|
|
autocmd BufNewFile,BufRead *.go nmap <silent> <leader>g6 :GoAlternate!<cr>
|
|
|
|
|
2021-01-27 14:32:26 +00:00
|
|
|
iabbrev mk make([]MyType, 0)<esc>9h
|
2022-06-09 03:49:33 +00:00
|
|
|
iabbrev wr w http.ResponseWriter, r *http.Request<c-r>=Eatchar('\s')<cr>
|
2021-01-27 14:32:26 +00:00
|
|
|
iabbrev ttt t *testing.T
|
2021-02-02 11:37:36 +00:00
|
|
|
iabbrev errP <esc>ccif err != nil {<cr>panic(err)<cr>}
|
|
|
|
iabbrev errl <esc>ccif err != nil {<cr>log.Println(err)<cr>}
|
2021-09-05 21:32:03 +00:00
|
|
|
iabbrev errf <esc>ccif err != nil {<cr>log.Fatal(err)<cr>}
|
2021-02-02 11:37:36 +00:00
|
|
|
iabbrev errp <esc>ccif err != nil {<cr>fmt.Println(err)<cr>}
|
|
|
|
iabbrev errr <esc>ccif err != nil {<cr>return err<cr>}
|
|
|
|
iabbrev defr <esc>ccdefer func() {<cr><cr>}()<esc>ki
|
2022-06-10 17:08:01 +00:00
|
|
|
iabbrev fmtpf fmt.Printf("\n")<esc>3hi<c-r>=Eatchar('\s')<cr>
|
2022-06-09 15:47:01 +00:00
|
|
|
iabbrev fmtpl fmt.Println("")<esc>hi<c-r>=Eatchar('\s')<cr>
|
2022-12-13 21:19:03 +00:00
|
|
|
iabbrev fmterr fmt.Errorf(": %s", err)<esc>10hi<c-r>=Eatchar('\s')<cr>
|
2022-06-10 17:08:01 +00:00
|
|
|
iabbrev logpf log.Printf("\n")<esc>3hi<c-r>=Eatchar('\s')<cr>
|
2022-06-09 03:49:33 +00:00
|
|
|
iabbrev logpl log.Println("")<esc>hi<c-r>=Eatchar('\s')<cr>
|
2021-05-31 08:29:55 +00:00
|
|
|
iabbrev ctxcc ctx context.Context
|
2021-12-20 20:09:44 +00:00
|
|
|
iabbrev err! err != nil {<cr><cr>}<esc>kcc<c-r>=Eatchar('\s')<cr>
|
2021-12-12 09:04:32 +00:00
|
|
|
iabbrev ior io.Reader
|
2022-06-17 15:08:53 +00:00
|
|
|
iabbrev iorc io.ReadCloser
|
2021-12-12 09:04:32 +00:00
|
|
|
iabbrev iow io.Writer
|
2021-12-22 12:33:54 +00:00
|
|
|
iabbrev gof go func() {<cr><cr>}()<esc>kcc<c-r>=Eatchar('\s')<cr>
|
2022-01-09 15:06:19 +00:00
|
|
|
iabbrev fortc for _, tc := range testCases {<cr>t.Run(tc.name, func(t *testing.T) {<cr><cr>})<cr>}<esc>kkcc<c-r>=Eatchar('\s')<cr>
|
2022-05-17 06:32:51 +00:00
|
|
|
iabbrev mapss map[string]string
|
|
|
|
iabbrev mapsi map[string]int
|
2022-06-09 03:49:33 +00:00
|
|
|
iabbrev mapsa map[string]any
|
2023-01-11 06:27:45 +00:00
|
|
|
iabbrev mapaa map[any]any
|