From 269c89ef598e6cd0fca57f5e1b9202bb86de2ca7 Mon Sep 17 00:00:00 2001 From: Eric Christopherson Date: Wed, 9 Apr 2014 21:55:34 -0500 Subject: [PATCH] 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. --- plugin/fugitive.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index dabc613..9d8bcb7 100644 --- 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('$')