mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
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.
This commit is contained in:
@@ -45,8 +45,6 @@ function! gitgutter#process_buffer(bufnr, force) abort
|
||||
endif
|
||||
|
||||
endif
|
||||
else
|
||||
call s:clear(a:bufnr)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user