[vim] Require fzf 0.53.0 or above (with --tmux)

Close #3980
This commit is contained in:
Junegunn Choi 2024-08-28 13:41:46 +09:00
parent e0924d27b8
commit d06c5ab990
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -198,6 +198,7 @@ function! s:compare_binary_versions(a, b)
return s:compare_versions(s:get_version(a:a), s:get_version(a:b)) return s:compare_versions(s:get_version(a:a), s:get_version(a:b))
endfunction endfunction
let s:min_version = '0.53.0'
let s:checked = {} let s:checked = {}
function! fzf#exec(...) function! fzf#exec(...)
if !exists('s:exec') if !exists('s:exec')
@ -225,7 +226,8 @@ function! fzf#exec(...)
let s:exec = binaries[-1] let s:exec = binaries[-1]
endif endif
if a:0 && !has_key(s:checked, a:1) let min_version = a:0 ? a:1 : s:min_version
if !has_key(s:checked, min_version)
let fzf_version = s:get_version(s:exec) let fzf_version = s:get_version(s:exec)
if empty(fzf_version) if empty(fzf_version)
let message = printf('Failed to run "%s --version"', s:exec) let message = printf('Failed to run "%s --version"', s:exec)
@ -233,17 +235,17 @@ function! fzf#exec(...)
throw message throw message
end end
if s:compare_versions(fzf_version, a:1) >= 0 if s:compare_versions(fzf_version, min_version) >= 0
let s:checked[a:1] = 1 let s:checked[min_version] = 1
return s:exec return s:exec
elseif a:0 < 2 && input(printf('You need fzf %s or above. Found: %s. Download binary? (y/n) ', a:1, fzf_version)) =~? '^y' elseif a:0 < 2 && input(printf('You need fzf %s or above. Found: %s. Download binary? (y/n) ', min_version, fzf_version)) =~? '^y'
let s:versions = {} let s:versions = {}
unlet s:exec unlet s:exec
redraw redraw
call fzf#install() call fzf#install()
return fzf#exec(a:1, 1) return fzf#exec(min_version, 1)
else else
throw printf('You need to upgrade fzf (required: %s or above)', a:1) throw printf('You need to upgrade fzf (required: %s or above)', min_version)
endif endif
endif endif