From 9c641584451d5321ad6fa2dca26295d6537c581c Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Tue, 26 Jan 2021 23:39:31 +0000 Subject: [PATCH] Replace vim-gitgutter with vim-signify vim-gitgutter is buggy. vim-signify might be better, it does allow configuration of which events trigger a sign column update and this patch takes advantage of that. Firstly, the `CursorHold` and `CursorHoldI` events are disabled and replaced with `InsertLeave` and `TextChanged` events. This makes the sign column updates immediate, and since vim-signify is asynchronous it's faster too. --- autoload/do.vim | 12 +++++++++++- colors/fresh.vim | 4 ++++ plugin/autocmds.vim | 3 +++ plugin/settings.vim | 5 +++++ vimrc | 9 ++------- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/autoload/do.vim b/autoload/do.vim index c0f39be..68ba12e 100644 --- a/autoload/do.vim +++ b/autoload/do.vim @@ -69,7 +69,7 @@ function! do#rename_include_guard(old) call setpos('.', l:pos) endfunction -" Setup and start a debugging command. +" Setup and start a debugging command function! do#debug(...) packadd termdebug let l:command = 'TermdebugCommand' @@ -86,3 +86,13 @@ function! do#last_change() norm!`` endif endfunction + +" Augment vim-signify update events +function! do#signify() abort + " Disable update on cursor hold + autocmd! signify CursorHold,CursorHoldI + " Enable updates on leaving insert mode + autocmd signify InsertLeave,TextChanged call sy#start() + " Enable update on text change e.g. undo/redo + autocmd signify TextChanged call sy#start() +endfunction diff --git a/colors/fresh.vim b/colors/fresh.vim index 95e81d3..fd4f372 100644 --- a/colors/fresh.vim +++ b/colors/fresh.vim @@ -207,5 +207,9 @@ if has('gui_running') || &t_Co == 256 call s:hi('SyntasticWarningLine', '', '', '') call s:hi('SyntasticError', '160', '', '') call s:hi('SyntasticWarning', '129', '', '') + + call s:hi('SignifySignAdd', '2', '233', '') + call s:hi('SignifySignChange', '3', '233', '') + call s:hi('SignifySignDelete', '1', '233', '') "" }}} endif diff --git a/plugin/autocmds.vim b/plugin/autocmds.vim index 0b73f1b..2132113 100644 --- a/plugin/autocmds.vim +++ b/plugin/autocmds.vim @@ -25,4 +25,7 @@ augroup benieAugroup au BufNewFile * silent! call snippet#template() " Do the same when filetype changes to help au FileType help silent! call snippet#template() + + " Augment vim-signify by modifying it's autocmds + au User SignifyAutocmds call do#signify() augroup END diff --git a/plugin/settings.vim b/plugin/settings.vim index 0412abe..a1684d2 100644 --- a/plugin/settings.vim +++ b/plugin/settings.vim @@ -162,6 +162,11 @@ set mouse=a " q - allow formatting with 'gq' set formatoptions+=rq +" Always show the signcolum +if exists('&signcolumn') + set signcolumn=yes +endif + " Enable modeline set modeline diff --git a/vimrc b/vimrc index 06231e4..50d9277 100644 --- a/vimrc +++ b/vimrc @@ -68,13 +68,8 @@ let g:ale_linters = {'c': [], 'cpp': []} let g:ale_cmake_cmakelint_options = \ '-convention/filename,-package/consistency,-package/stdargs' -" git diff in the sign column -Pack 'airblade/vim-gitgutter' -if exists('&signcolumn') - set signcolumn=yes -else - let g:gitgutter_sign_column_always = 1 -endif +" Version control differences in the sign column +Pack 'mhinz/vim-signify' " format.vim - format with text objects Pack 'git@bitbucket.org:infektor/format.vim.git'