mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2025-01-10 18:24:39 +00:00
[vim] handle SwapExists
The SwapExists dialog prevents multiple files from being opening if the dialog occurs before all files are opened. Opening the files is more important than showing the dialog, so choose "readonly" automatically and continue opening files.
This commit is contained in:
parent
862da2c0b1
commit
c4e5ee63bb
@ -405,6 +405,12 @@ function! s:cmd_callback(lines) abort
|
|||||||
endif
|
endif
|
||||||
let key = remove(a:lines, 0)
|
let key = remove(a:lines, 0)
|
||||||
let cmd = get(s:action, key, 'e')
|
let cmd = get(s:action, key, 'e')
|
||||||
|
if len(a:lines) > 1
|
||||||
|
augroup fzf_swap
|
||||||
|
autocmd SwapExists * let v:swapchoice='o'
|
||||||
|
\| call s:warn('fzf: E325: swap file exists: '.expand('<afile>'))
|
||||||
|
augroup END
|
||||||
|
endif
|
||||||
try
|
try
|
||||||
let autochdir = &autochdir
|
let autochdir = &autochdir
|
||||||
set noautochdir
|
set noautochdir
|
||||||
@ -413,6 +419,7 @@ function! s:cmd_callback(lines) abort
|
|||||||
endfor
|
endfor
|
||||||
finally
|
finally
|
||||||
let &autochdir = autochdir
|
let &autochdir = autochdir
|
||||||
|
silent! autocmd! fzf_swap
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user