dotfiles/vim/after/ftplugin/go.vim

50 lines
1.7 KiB
VimL
Raw Normal View History

2021-01-27 14:32:26 +00:00
map <Leader>gb :GoBuild<CR>
map <Leader>i :GoImplements<CR>
map <Leader>^ :GoAlternate<CR>
map <Leader>d :GoDoc<CR>
2021-01-27 19:17:05 +00:00
map <leader>gv <esc>:vsplit<bar>:GoAlternate!<cr>
map <leader>gs <esc>:split<bar>:GoAlternate!<cr>
map <leader>gt <esc>:w <bar> :GoTest<cr>
map <leader>gf <esc>:w <bar> :GoTestFunc<cr>
2021-01-28 19:23:15 +00:00
nnoremap <silent> gd :GoToDefinition
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>
" Vim-Go configuration:
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"
2021-01-28 08:21:55 +00:00
let g:go_highlight_functions = 1
let g:go_term_enabled = 0
let g:go_term_close_on_exit = 0
2021-01-28 19:23:15 +00:00
let g:go_gopls_analyses = {
\ 'composites': v:false,
\ }
2021-01-27 19:17:05 +00:00
let g:go_fmt_options = {
2021-01-29 13:53:15 +00:00
\ 'goimports': '-local github.com/sensiblecodeio/cantabular',
2021-01-27 19:17:05 +00:00
\ }
2021-01-28 08:21:55 +00:00
2021-01-27 19:17:05 +00:00
autocmd BufNewFile,BufRead *.gohtml set syntax=gohtmltmpl
autocmd BufNewFile,BufRead *.go nmap <silent> <leader>g6 :GoAlternate!<cr>
2021-01-27 14:32:26 +00:00
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 fttt <ESC>ccfunc TestSomething(t *testing.T) {<cr>}<esc>k9l
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>}
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