Clever window size on :Gcommit from :Gstatus
This commit is contained in:
parent
1ecd40d002
commit
8638d7b059
@ -767,7 +767,6 @@ endfunction
|
|||||||
call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit :execute s:Commit(<q-args>)")
|
call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit :execute s:Commit(<q-args>)")
|
||||||
|
|
||||||
function! s:Commit(args) abort
|
function! s:Commit(args) abort
|
||||||
let old_type = s:buffer().type()
|
|
||||||
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
|
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
|
||||||
let dir = getcwd()
|
let dir = getcwd()
|
||||||
let msgfile = s:repo().dir('COMMIT_EDITMSG')
|
let msgfile = s:repo().dir('COMMIT_EDITMSG')
|
||||||
@ -812,15 +811,15 @@ function! s:Commit(args) abort
|
|||||||
if args !~# '\%(^\| \)--cleanup\>'
|
if args !~# '\%(^\| \)--cleanup\>'
|
||||||
let args = '--cleanup=strip '.args
|
let args = '--cleanup=strip '.args
|
||||||
endif
|
endif
|
||||||
let old_nr = bufnr('')
|
|
||||||
if bufname('%') == '' && line('$') == 1 && getline(1) == '' && !&mod
|
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
|
else
|
||||||
keepalt split `=msgfile`
|
keepalt split `=msgfile`
|
||||||
endif
|
endif
|
||||||
if old_type ==# 'index'
|
|
||||||
execute 'bdelete '.old_nr
|
|
||||||
endif
|
|
||||||
let b:fugitive_commit_arguments = args
|
let b:fugitive_commit_arguments = args
|
||||||
setlocal bufhidden=delete filetype=gitcommit
|
setlocal bufhidden=delete filetype=gitcommit
|
||||||
return '1'
|
return '1'
|
||||||
|
Loading…
Reference in New Issue
Block a user