From b3262c28d654043654954a3df9396b1de85be9ab Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 19 Aug 2011 02:40:34 -0400 Subject: [PATCH] No preview window business for :Gread --- plugin/fugitive.vim | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 1c3a437..8fa0410 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -899,6 +899,22 @@ endfunction " Gedit, Gpedit, Gsplit, Gvsplit, Gtabedit, Gread {{{1 function! s:Edit(cmd,...) abort + if a:cmd !~# 'read' + if &previewwindow && getbufvar('','fugitive_type') ==# 'index' + wincmd p + if &diff + let mywinnr = winnr() + for winnr in range(winnr('$'),1,-1) + if winnr != mywinnr && getwinvar(winnr,'&diff') + execute winnr.'wincmd w' + close + wincmd p + endif + endfor + endif + endif + endif + if a:0 && a:1 == '' return '' elseif a:0 @@ -916,19 +932,6 @@ function! s:Edit(cmd,...) abort if a:cmd ==# 'read' return 'silent %delete_|read '.s:fnameescape(file).'|silent 1delete_|diffupdate|'.line('.') else - if &previewwindow && getbufvar('','fugitive_type') ==# 'index' - wincmd p - if &diff - let mywinnr = winnr() - for winnr in range(winnr('$'),1,-1) - if winnr != mywinnr && getwinvar(winnr,'&diff') - execute winnr.'wincmd w' - close - wincmd p - endif - endfor - endif - endif return a:cmd.' '.s:fnameescape(file) endif endfunction