From 37bdd03d176c5e182c7e8dbdc79c3f71d2a04898 Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Fri, 16 Mar 2018 18:49:22 +0000 Subject: [PATCH] Do not deactivate gitgutter when &diff is set. In #303 there was a request to deactivate gitgutter when &diff is set, although no reason was given initially. Then it was reported that gitgutter showed signs, in the wrong place, during Fugitive's Gdiff. However I cannot reproduce signs showing in Gdiff's index buffer. And the signs in the working tree buffer are correct. Furthermore the commit which deactivated gitgutter (85f6e136) had the side-effect of breaking `:redir` and clearing Vim's startup message (see #500). Therefore since that change had no benefit, and a couple of drawbacks, it makes sense to undo it. Closes #500. --- autoload/gitgutter.vim | 2 -- autoload/gitgutter/utility.vim | 25 +------------------------ 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/autoload/gitgutter.vim b/autoload/gitgutter.vim index c7d5f3a..d095cd7 100644 --- a/autoload/gitgutter.vim +++ b/autoload/gitgutter.vim @@ -45,8 +45,6 @@ function! gitgutter#process_buffer(bufnr, force) abort endif endif - else - call s:clear(a:bufnr) endif endfunction diff --git a/autoload/gitgutter/utility.vim b/autoload/gitgutter/utility.vim index 1f283a3..bacbf22 100644 --- a/autoload/gitgutter/utility.vim +++ b/autoload/gitgutter/utility.vim @@ -50,8 +50,7 @@ function! gitgutter#utility#is_active(bufnr) abort \ !pumvisible() && \ s:is_file_buffer(a:bufnr) && \ s:exists_file(a:bufnr) && - \ s:not_git_dir(a:bufnr) && - \ !s:vimdiff(a:bufnr) + \ s:not_git_dir(a:bufnr) endfunction function! s:not_git_dir(bufnr) abort @@ -206,28 +205,6 @@ function! s:strip_trailing_new_line(line) abort return substitute(a:line, '\n$', '', '') endfunction -" Returns 1 if any of the given buffer's windows has the `&diff` option set, -" or 0 otherwise. -if exists('*win_findbuf') - function! s:vimdiff(bufnr) abort - for winid in win_findbuf(a:bufnr) - if getwinvar(winid, '&diff') - return 1 - endif - endfor - return 0 - endfunction -else - function! s:vimdiff(bufnr) abort - for winnr in range(1, winnr('$')) - if winbufnr(winnr) == a:bufnr && getwinvar(winnr, '&diff') - return 1 - endif - endfor - return 0 - endfunction -endif - function! s:windows() return has('win64') || has('win32') || has('win16') endfunction