92 lines
3.2 KiB
VimL
92 lines
3.2 KiB
VimL
nmap <silent> gvd <Plug>(go-def-vertical)
|
|
nmap <silent> gsd <Plug>(go-def-split)
|
|
nmap <silent> gvD <Plug>(go-def-type-vertical)
|
|
nmap <silent> gsD <Plug>(go-def-type-split)
|
|
|
|
nmap <silent> <leader>gb :up<bar>:GoBuild<cr>
|
|
nmap <silent> <leader>gr :up<bar>:GoRun<cr>
|
|
nmap <silent> <leader>gc :GoCallers<cr>
|
|
" TODO: if GoInfo returns nothing an [INFO] SUCCESS message is shown.
|
|
" But disabling g:go_echo_command_info impacts build and test workflow.
|
|
nmap <silent> <leader>gi :GoInfo<cr>
|
|
nmap <silent> <leader>gp :GoImplements<cr>
|
|
nmap <silent> <leader>ga :GoAlternate<cr>
|
|
nmap <silent> <leader>gk :GoDocBrowser<cr>
|
|
nmap <silent> <leader>gd :GoDecls<cr>
|
|
nmap <silent> <leader>gD :GoDeclsDir<cr>
|
|
" mnemonic: match
|
|
nmap <silent> <leader>gm :GoSameIds<cr>
|
|
|
|
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>
|
|
nmap <silent> <leader>gt <esc>:up<bar>:GoTest<cr>
|
|
nmap <silent> <leader>gf <esc>:up<bar>:GoTestFunc<cr>
|
|
nmap <silent> <leader>gat <esc>:GoAddTags<cr>
|
|
nmap <silent> <leader>grt <esc>:GoRemoveTags<cr>
|
|
nmap <silent> <leader>gec <esc>:up<bar>:GoErrCheck<cr>
|
|
|
|
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>
|
|
|
|
" Avoid window positions jumping around when building and testing:
|
|
set cmdheight=2
|
|
|
|
" fzf configuration:
|
|
let g:fzf_action = {
|
|
\ 'ctrl-t': 'tab split',
|
|
\ 'ctrl-s': 'split',
|
|
\ 'ctrl-v': 'vsplit' }
|
|
|
|
" Vim-Go configuration:
|
|
let g:go_decls_mode = 'fzf'
|
|
let g:go_fmt_autosave = 0
|
|
" Vim-Go seems to handle fix-on-save better than ALE:
|
|
let g:go_imports_autosave = 1
|
|
let g:go_auto_sameids = 0
|
|
let g:go_auto_type_info = 0
|
|
let g:go_info_mode = 'gopls'
|
|
" ALE handles auto type info:
|
|
let g:go_auto_type_info = 0
|
|
let g:go_code_completion_enabled = 1
|
|
let g:go_echo_command_info = 0
|
|
let g:go_echo_go_info = 0
|
|
let g:go_highlight_functions = 1
|
|
" g:go_statusline_duration doesn't seem to work accurately, but does help:
|
|
let g:go_statusline_duration = 1000
|
|
let g:go_gopls_analyses = {
|
|
\ 'composites': v:false,
|
|
\ 'unusedparams': v:true,
|
|
\ 'unusedresult': v:true,
|
|
\ 'shadow': v:true,
|
|
\ }
|
|
let g:go_fmt_options = {
|
|
\ 'goimports': '-local github.com/sensiblecodeio/cantabular',
|
|
\ }
|
|
|
|
autocmd BufNewFile,BufRead *.go nmap <silent> <leader>g6 :GoAlternate!<cr>
|
|
|
|
iabbrev fmtpl fmt.Println("")<esc>hi
|
|
iabbrev fmtpf fmt.Printf("\n")<esc>3hi
|
|
iabbrev mk make([]MyType, 0)<esc>9h
|
|
iabbrev wr w http.ResponseWriter, r *http.Request
|
|
iabbrev httph http.Handler
|
|
iabbrev httphf http.HandlerFunc
|
|
iabbrev fttt <ESC>ccfunc TestSomething(t *testing.T) {<cr>}<esc>k9l
|
|
iabbrev ttt t *testing.T
|
|
iabbrev errP <esc>ccif err != nil {<cr>panic(err)<cr>}
|
|
iabbrev errl <esc>ccif err != nil {<cr>log.Println(err)<cr>}
|
|
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
|
|
iabbrev []b []byte()<esc>i
|
|
iabbrev logd log.Debug().Msg("
|
|
iabbrev logi log.Info().Msg("
|
|
iabbrev loge log.Error().Msg("
|
|
iabbrev logf log.Fatal().Msg("
|