commit f72ad6009713a2c8ce84d175145f8395efffa080 (tree)
parent 8686eb17e08e4b18dec069a83bd7798823e24335
Author: Tim Pope <code@tpope.net>
Date: Thu, 15 Apr 2021 10:02:19 -0400
Only do "guessed" :Gwrite behaviors with no argument
These seem pretty silly these days and should probably be removed, but
let's start by reducing their scope.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -5058,9 +5058,9 @@ endfunction
" Section: :Gwrite, :Gwq
function! fugitive#WriteCommand(line1, line2, range, bang, mods, arg, args) abort
- if s:cpath(expand('%:p'), fugitive#Find('.git/COMMIT_EDITMSG'))
+ if s:cpath(expand('%:p'), fugitive#Find('.git/COMMIT_EDITMSG')) && empty(a:arg)
return (empty($GIT_INDEX_FILE) ? 'write|bdelete' : 'wq') . (a:bang ? '!' : '')
- elseif get(b:, 'fugitive_type', '') ==# 'index'
+ elseif get(b:, 'fugitive_type', '') ==# 'index' && empty(a:arg)
return 'Git commit'
elseif &buftype ==# 'nowrite' && getline(4) =~# '^[+-]\{3\} '
return 'echoerr ' . string('fugitive: :Gwrite from :Git diff has been removed in favor of :Git add --edit')