motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit 0713b84f977fc263abde0d000998e2f149c62fae (tree)
parent 93b434949be1dc55e82dd4a4a4399eacf701e3d1
Author: Tim Pope <code@tpope.net>
Date:   Fri, 26 Mar 2021 12:03:20 -0400

Don't wait silently on :wall with 'confirm'

Diffstat:
Mautoload/fugitive.vim | 23++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim @@ -199,6 +199,23 @@ function! s:Map(mode, lhs, rhs, ...) abort endfor endfunction +function! fugitive#Autowrite() abort + if &autowrite || &autowriteall + try + if &confirm + let reconfirm = 1 + setglobal noconfirm + endif + silent! wall + finally + if exists('reconfirm') + setglobal confirm + endif + endtry + endif + return '' +endfunction + " Section: Git function! s:UserCommandList(...) abort @@ -2656,10 +2673,10 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort let mods = substitute(s:Mods(a:mods), '\<tab\>', '-tab', 'g') let assign = len(dir) ? '|let b:git_dir = ' . string(dir) : '' if has('nvim') - if &autowrite || &autowriteall | silent! wall | endif + call fugitive#Autowrite() return mods . (a:line2 ? 'split' : 'edit') . ' term://' . s:fnameescape(s:UserCommand(options, args)) . assign . '|startinsert' . after elseif has('terminal') - if &autowrite || &autowriteall | silent! wall | endif + call fugitive#Autowrite() return 'exe ' . string(mods . 'terminal ' . (a:line2 ? '' : '++curwin ') . join(map(s:UserCommandList(options) + args, 's:fnameescape(v:val)'))) . assign . after endif endif @@ -2704,7 +2721,7 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort let args = s:disable_colors + flags + ['-c', 'advice.waitingForEditor=false'] + args let argv = s:UserCommandList({'git': git, 'dir': dir}) + args let [argv, jobopts] = s:JobOpts(argv, env) - if &autowrite || &autowriteall | silent! wall | endif + call fugitive#Autowrite() call writefile([], state.file, 'b') call s:RunSave(state) echo ""