From ca03f1d0699a8fc62ac162eefbf5b5c05cf38cd7 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 4 Jul 2021 08:14:06 -0400 Subject: [PATCH] Fix write in index with guioptions=! --- autoload/fugitive.vim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 0178a7c..14a95d6 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -2258,6 +2258,10 @@ function! fugitive#FileWriteCmd(...) abort if commit !~# '^[0-3]$' || !v:cmdbang && (line("'[") != 1 || line("']") != line('$')) return "noautocmd '[,']write" . (v:cmdbang ? '!' : '') . ' ' . s:fnameescape(amatch) endif + if exists('+guioptions') && &guioptions =~# '!' + let guioptions = &guioptions + set guioptions-=! + endif silent execute "'[,']write !".fugitive#Prepare(dir, 'hash-object', '-w', '--stdin', '--').' > '.tmp let sha1 = readfile(tmp)[0] let old_mode = matchstr(s:SystemError([dir, 'ls-files', '--stage', '.' . file])[0], '^\d\+') @@ -2275,6 +2279,9 @@ function! fugitive#FileWriteCmd(...) abort return 'echoerr '.string('fugitive: '.error) endif finally + if exists('guioptions') + let &guioptions = guioptions + endif call delete(tmp) endtry endfunction