mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-13 13:53:51 -05:00
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.
This commit is contained in:
committed by
Tim Pope
parent
e6e259c2d2
commit
269c89ef59
@@ -2078,7 +2078,10 @@ function! s:ReplaceCmd(cmd,...) abort
|
|||||||
try
|
try
|
||||||
silent edit!
|
silent edit!
|
||||||
finally
|
finally
|
||||||
|
try
|
||||||
silent exe 'keepalt file '.s:fnameescape(fn)
|
silent exe 'keepalt file '.s:fnameescape(fn)
|
||||||
|
catch /^Vim\%((\a\+)\)\=:E302/
|
||||||
|
endtry
|
||||||
call delete(tmp)
|
call delete(tmp)
|
||||||
if fnamemodify(bufname('$'), ':p') ==# tmp
|
if fnamemodify(bufname('$'), ':p') ==# tmp
|
||||||
silent execute 'bwipeout '.bufnr('$')
|
silent execute 'bwipeout '.bufnr('$')
|
||||||
|
|||||||
Reference in New Issue
Block a user