motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit 22a832f958a7ed290046969cb33a91deb09fbe12 (tree)
parent e954d364f5cbbff47b7a0626f4339aad9e5279d2
Author: Tim Pope <code@tpope.net>
Date:   Sat, 13 Nov 2010 20:04:34 -0500

Fix focus anomaly when closing a split

This is seemingly the cause of an incompatibility with the DirDiff
plugin.

Diffstat:
Mplugin/fugitive.vim | 22++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim @@ -1013,8 +1013,8 @@ call s:command("-bar -nargs=? -complete=customlist,s:EditComplete Gsdiff :execut augroup fugitive_diff autocmd! - autocmd BufWinLeave * if s:diff_window_count() == 2 && &diff && getbufvar(+expand('<abuf>'), 'git_dir') !=# '' | execute 'windo call s:diff_off()' | endif - autocmd BufWinEnter * if s:diff_window_count() == 1 && &diff && getbufvar(+expand('<abuf>'), 'git_dir') !=# '' | call s:diff_off() | endif + autocmd BufWinLeave * if s:diff_window_count() == 2 && &diff && getbufvar(+expand('<abuf>'), 'git_dir') !=# '' | call s:diff_off_all() | endif + autocmd BufWinEnter * if s:diff_window_count() == 1 && &diff && getbufvar(+expand('<abuf>'), 'git_dir') !=# '' | diffoff | endif augroup END function! s:diff_window_count() @@ -1025,10 +1025,20 @@ function! s:diff_window_count() return c endfunction -function! s:diff_off() - if &l:diff - diffoff - endif +function! s:diff_off_all() + for nr in range(1,winnr('$')) + if getwinvar(nr,'&diff') + if winnr != winnr() + execute winnr.'wincmd w' + let restorewinnr = 1 + endif + execute nr.'wincmd w' + diffoff + if exists('restorewinnr') + wincmd p + endif + endif + endfor endfunction function! s:buffer_compare_age(commit) dict abort