commit 269c89ef598e6cd0fca57f5e1b9202bb86de2ca7 (tree)
parent e6e259c2d23d0332ab2f64c820b3d73670f5a96c
Author: Eric Christopherson <echristopherson@gmail.com>
Date: Wed, 9 Apr 2014 21:55:34 -0500
Ignore E302 "Could not rename swap file" error
According to `:help E302`, E302 comes from Vim being unable to rename
the swap file when an open buffer's name is changed; but the error is
mostly harmless. E302 seems to occur in vim-fugitive under Windows but
not *nix.
This fix allow :Glog and :Gdiff to work on such systems; previously the
uncaught error made these operations fail or at least work strangely.
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -2078,7 +2078,10 @@ function! s:ReplaceCmd(cmd,...) abort
try
silent edit!
finally
- silent exe 'keepalt file '.s:fnameescape(fn)
+ try
+ silent exe 'keepalt file '.s:fnameescape(fn)
+ catch /^Vim\%((\a\+)\)\=:E302/
+ endtry
call delete(tmp)
if fnamemodify(bufname('$'), ':p') ==# tmp
silent execute 'bwipeout '.bufnr('$')