commit 8638d7b059f7e9f9951ff751c58100a543763180 (tree)
parent 1ecd40d0025f04dcb84e85732753322fd6ff0372
Author: Tim Pope <code@tpope.net>
Date: Mon, 5 Sep 2011 20:46:52 -0400
Clever window size on :Gcommit from :Gstatus
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -767,7 +767,6 @@ endfunction
call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit :execute s:Commit(<q-args>)")
function! s:Commit(args) abort
- let old_type = s:buffer().type()
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let dir = getcwd()
let msgfile = s:repo().dir('COMMIT_EDITMSG')
@@ -812,15 +811,15 @@ function! s:Commit(args) abort
if args !~# '\%(^\| \)--cleanup\>'
let args = '--cleanup=strip '.args
endif
- let old_nr = bufnr('')
if bufname('%') == '' && line('$') == 1 && getline(1) == '' && !&mod
- edit `=msgfile`
+ keepalt edit `=msgfile`
+ elseif s:buffer().type() ==# 'index'
+ keepalt edit `=msgfile`
+ execute (search('^#','n')+1).'wincmd+'
+ setlocal nopreviewwindow
else
keepalt split `=msgfile`
endif
- if old_type ==# 'index'
- execute 'bdelete '.old_nr
- endif
let b:fugitive_commit_arguments = args
setlocal bufhidden=delete filetype=gitcommit
return '1'