From 4139dc521c2219c13ee3741c4b17216b8d832880 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 15 Apr 2021 10:14:29 -0400 Subject: [PATCH] Support :Gwrite +aftercommand Closes https://github.com/tpope/vim-fugitive/pull/562 --- autoload/fugitive.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 7164de4..4f77692 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -5067,8 +5067,13 @@ function! fugitive#WriteCommand(line1, line2, range, bang, mods, arg, args) abor endif let mytab = tabpagenr() let mybufnr = bufnr('') + let args = s:ArgSplit(a:arg) + let after = '' + if get(args, 0) =~# '^+' + let after = '|' . remove(args, 0)[1:-1] + endif try - let file = len(a:arg) ? s:Generate(s:Expand(a:arg)) : fugitive#Real(@%) + let file = len(args) ? s:Generate(s:Expand(join(args, ' '))) : fugitive#Real(@%) catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry @@ -5183,7 +5188,7 @@ function! fugitive#WriteCommand(line1, line2, range, bang, mods, arg, args) abor endfor endfor call fugitive#ReloadStatus(-1, 1) - return 'checktime' + return 'silent checktime' . after endfunction function! fugitive#WqCommand(...) abort