From bc3d36e559e446d963e0b1dd832d3b39ea233241 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 9 Aug 2019 00:44:04 -0400 Subject: [PATCH] Remove 'guioptions' workaround --- autoload/fugitive.vim | 58 +++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index bfecdfa..8d604b7 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -3246,41 +3246,33 @@ function! s:CommitSubcommand(line1, line2, range, bang, mods, args, ...) abort let msgfile = fugitive#Find('.git/COMMIT_EDITMSG', dir) let outfile = tempname() try - let guioptions = &guioptions - try - if &guioptions =~# '!' - setglobal guioptions-=! - endif - if s:winshell() - let command = 'set GIT_EDITOR=false& ' + if s:winshell() + let command = 'set GIT_EDITOR=false& ' + else + let command = 'env GIT_EDITOR=false ' + endif + let argv = a:args + let i = 0 + while get(argv, i, '--') !=# '--' + if argv[i] =~# '^-[apzsneiovq].' + call insert(argv, argv[i][0:1]) + let argv[i+1] = '-' . argv[i+1][2:-1] else - let command = 'env GIT_EDITOR=false ' + let i += 1 endif - let argv = a:args - let i = 0 - while get(argv, i, '--') !=# '--' - if argv[i] =~# '^-[apzsneiovq].' - call insert(argv, argv[i][0:1]) - let argv[i+1] = '-' . argv[i+1][2:-1] - else - let i += 1 - endif - endwhile - let command .= s:UserCommand(dir) . ' commit ' . s:shellesc(argv) - if (&autowrite || &autowriteall) && !a:0 - silent! wall - endif - if s:HasOpt(argv, '-i', '--interactive') - return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 0) - elseif s:HasOpt(argv, '-p', '--patch') - return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 1) - else - let [error_string, exec_error] = s:TempCmd(outfile, command) - let errors = split(error_string, "\n") - endif - finally - let &guioptions = guioptions - endtry + endwhile + let command .= s:UserCommand(dir) . ' commit ' . s:shellesc(argv) + if (&autowrite || &autowriteall) && !a:0 + silent! wall + endif + if s:HasOpt(argv, '-i', '--interactive') + return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 0) + elseif s:HasOpt(argv, '-p', '--patch') + return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 1) + else + let [error_string, exec_error] = s:TempCmd(outfile, command) + let errors = split(error_string, "\n") + endif if !has('gui_running') redraw! endif