mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-13 05:43:52 -05:00
Fix :Gwrite DWIM in commit messages
Closes https://github.com/tpope/vim-fugitive/issues/1599
This commit is contained in:
@@ -4627,10 +4627,8 @@ endfunction
|
||||
" Section: :Gwrite, :Gwq
|
||||
|
||||
function! fugitive#WriteCommand(line1, line2, range, bang, mods, arg, args) abort
|
||||
if exists('b:fugitive_commit_arguments')
|
||||
return 'write|bdelete'
|
||||
elseif expand('%:t') == 'COMMIT_EDITMSG' && $GIT_INDEX_FILE != ''
|
||||
return 'wq'
|
||||
if s:cpath(expand('%:p'), fugitive#Find('.git/COMMIT_EDITMSG'))
|
||||
return (empty($GIT_INDEX_FILE) ? 'write|bdelete' : 'wq') . (a:bang ? '!' : '')
|
||||
elseif get(b:, 'fugitive_type', '') ==# 'index'
|
||||
return 'Git commit'
|
||||
elseif &buftype ==# 'nowrite' && getline(4) =~# '^[+-]\{3\} '
|
||||
@@ -4759,7 +4757,7 @@ endfunction
|
||||
|
||||
function! fugitive#WqCommand(...) abort
|
||||
let bang = a:4 ? '!' : ''
|
||||
if exists('b:fugitive_commit_arguments')
|
||||
if s:cpath(expand('%:p'), fugitive#Find('.git/COMMIT_EDITMSG'))
|
||||
return 'wq'.bang
|
||||
endif
|
||||
let result = call('fugitive#WriteCommand', a:000)
|
||||
|
||||
Reference in New Issue
Block a user