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