From 69061dfe7f7ef5ae21cdc97a890c0e69310812bf Mon Sep 17 00:00:00 2001 From: Rob Watson Date: Thu, 18 Mar 2021 09:05:37 +0100 Subject: [PATCH] Update vim and gitconfig --- gitconfig | 1 + vim/after/ftplugin/go.vim | 45 +++++++++++++++++++++++---------------- vimrc | 17 +++++---------- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/gitconfig b/gitconfig index 738dd37..8542111 100644 --- a/gitconfig +++ b/gitconfig @@ -25,6 +25,7 @@ rr = !git reset --hard $(git rb) shp = show -p s = status + ss = stash save st = status undo = reset --soft HEAD^ [user] diff --git a/vim/after/ftplugin/go.vim b/vim/after/ftplugin/go.vim index e56b3e9..c2cbf7e 100644 --- a/vim/after/ftplugin/go.vim +++ b/vim/after/ftplugin/go.vim @@ -1,22 +1,24 @@ -nmap gb :up:GoBuild -nmap gr :GoRun -nmap gc :GoCallers -nmap gi :GoImplements -nmap ^ :GoAlternate -nmap gk :GoDocBrowser -nmap gd :GoDecls -nmap gD :GoDeclsDir +nmap gb :up:GoBuild +nmap gr :up:GoRun +nmap gc :GoCallers +" TODO: if GoInfo returns nothing an [INFO] SUCCESS message is shown. +" But disabling g:go_echo_command_info impacts build and test workflow. +nmap gi :GoInfo +nmap gp :GoImplements +nmap ga :GoAlternate +nmap gk :GoDocBrowser +nmap gd :GoDecls +nmap gD :GoDeclsDir " mnemonic: match -nmap gm :GoSameIds +nmap gm :GoSameIds -nmap gv :vsplit:GoAlternate! -nmap gs :split:GoAlternate! -nmap gt :up:GoTest -nmap gf :up:GoTestFunc -nmap gat :GoAddTags -nmap grt :GoRemoveTags -nmap gec :up:GoErrCheck -nmap gie :GoIfErr +nmap gv :vsplit:GoAlternate! +nmap gs :split:GoAlternate! +nmap gt :up:GoTest +nmap gf :up:GoTestFunc +nmap gat :GoAddTags +nmap grt :GoRemoveTags +nmap gec :up:GoErrCheck nnoremap dr :GoDebugBreakpoint nnoremap d! :GoDebugStart @@ -25,10 +27,13 @@ nnoremap dq :GoDebugStop nnoremap dn :GoDebugNext nnoremap ds :GoDebugStep +" Avoid window positions jumping around when building and testing: +set cmdheight=2 + " fzf configuration: let g:fzf_action = { \ 'ctrl-t': 'tab split', - \ 'ctrl-x': 'split', + \ 'ctrl-s': 'split', \ 'ctrl-v': 'vsplit' } " Vim-Go configuration: @@ -39,6 +44,10 @@ 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 this: +let g:go_auto_type_info = 0 +let g:go_echo_command_info = 1 +let g:go_echo_go_info = 0 let g:go_highlight_functions = 1 let g:go_term_enabled = 0 let g:go_term_close_on_exit = 0 diff --git a/vimrc b/vimrc index 5f6bfca..357a5e9 100644 --- a/vimrc +++ b/vimrc @@ -93,7 +93,7 @@ augroup vimrc autocmd InsertEnter * set cul autocmd InsertLeavePre * set nocul " use tabs in .gitconfig - autocmd FileType gitconfig setlocal shiftwidth=2 tabstop=2 noexpandtab + autocmd BufEnter .gitconfig setlocal shiftwidth=2 tabstop=2 noexpandtab augroup end " But, don't remember the current directory for a given file: @@ -186,15 +186,6 @@ let g:echodoc#enable_at_startup = 1 packadd! echodoc.vim " ALE configuration: -function SymbolSearch() - call inputsave() - let s:pattern = trim(input('symbol search: ')) - call inputrestore() - if len(s:pattern) > 0 - execute 'ALESymbolSearch' s:pattern - endif -endfunction -map ss :call SymbolSearch() nmap [L (ale_first) nmap ]L (ale_previous_wrap_error) @@ -223,6 +214,7 @@ let g:ale_lint_on_insert_leave = 1 let g:ale_lint_on_save = 1 let g:ale_echo_cursor = 1 let g:ale_lint_delay = 100 +let g:ale_lsp_suggestions = 1 let g:ale_set_balloons = 1 " NOTE: Needs https://github.com/dense-analysis/ale/issues/3350 let g:ale_rust_analyzer_config = { @@ -242,8 +234,7 @@ let g:ale_go_gopls_init_options = {'ui.diagnostic.analyses': { let g:ale_completion_enabled = 0 let g:ale_close_preview_on_insert = 1 let g:ale_hover_to_preview = 1 -let g:ale_sign_column_always = 1 -let g:ale_history_log_output = 1 +let g:ale_history_log_output = 0 let g:ale_linters = { \ 'javascript': ['eslint'], \ 'go': ['gopls'], @@ -280,3 +271,5 @@ packadd! fzf.vim packadd! vim-go packadd! vim-surround packadd! vim-yaml-folds +packadd! splitjoin.vim +packadd! vim-fugitive