vimrc: extract Go config

This commit is contained in:
Rob Watson 2021-01-27 20:17:05 +01:00
parent 06837b9c10
commit 2864b882cf
2 changed files with 30 additions and 22 deletions

View File

@ -3,6 +3,31 @@ map <Leader>i :GoImplements<CR>
map <Leader>^ :GoAlternate<CR>
map <Leader>d :GoDoc<CR>
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>
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"
let g:go_fmt_options = {
\ 'goimports': '-local github.com/sensiblecode.com/cantabular',
\ }
autocmd BufNewFile,BufRead *.gohtml set syntax=gohtmltmpl
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

27
vimrc
View File

@ -60,7 +60,7 @@ set pastetoggle=<f2>
" See :help thesaurus
set thesaurus=$HOME/Documents/thesaurus/thesaurus_pkg/thesaurus.txt
set pumheight=200
set completeopt=menu,menuone,popup,longest,noselect,noinsert
set completeopt=menu,menuone,popup,longest,noselect
set completepopup=width:300,height:50,align:item,border:off
" Colour scheme:
@ -93,17 +93,9 @@ map <leader>m :marks<cr>
map <leader>R :registers<cr>
map <leader>v :vsplit<cr>
map <leader>s :split<cr>
map <leader>gv <esc>:vsplit<bar>:GoAlternate<cr>
map <leader>gs <esc>:split<bar>:GoAlternate<cr>
map <leader>! <esc>:only<cr>
" ctrl-c to unload a buffer
nnoremap <silent> <c-q> :bp\|bd #<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>
function! ToggleQuickFix()
if empty(filter(getwininfo(), 'v:val.quickfix'))
@ -132,9 +124,10 @@ packadd! deoplete.nvim
let g:deoplete#enable_at_startup = 1
call deoplete#custom#option('num_processes', 6)
" https://github.com/Shougo/deoplete.nvim/issues/965#issuecomment-482925193
call deoplete#custom#option('omni_patterns', {
\ 'go': '[^. *\t]\.\w*',
\})
" Seems to be causing autocomplete issues so removing for now.
" call deoplete#custom#option('omni_patterns', {
" \ 'go': '[^. *\t]\.\w*',
" \})
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr><s-TAB> pumvisible() ? "\<C-p>" : "\<s-TAB>"
@ -158,16 +151,6 @@ packadd! command-t
" Lightline configuration:
set laststatus=2
" 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_fmt_options = {
\ 'goimports': '-local github.com/sensiblecode.com/cantabular',
\ }
autocmd BufNewFile,BufRead *.gohtml set syntax=gohtmltmpl
autocmd BufNewFile,BufRead *.go nmap <silent> <leader>g6 :GoAlternate!<cr>
" Vim-Rust configuration:
let g:rustfmt_autosave = 1