Skip to content

Commit

Permalink
[vim] Require fzf 0.53.0 or above (with --tmux)
Browse files Browse the repository at this point in the history
Close #3980
  • Loading branch information
junegunn committed Aug 28, 2024
1 parent e0924d2 commit d06c5ab
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions plugin/fzf.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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))
endfunction

let s:min_version = '0.53.0'
let s:checked = {}
function! fzf#exec(...)
if !exists('s:exec')
Expand Down Expand Up @@ -225,25 +226,26 @@ function! fzf#exec(...)
let s:exec = binaries[-1]
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)
if empty(fzf_version)
let message = printf('Failed to run "%s --version"', s:exec)
unlet s:exec
throw message
end

if s:compare_versions(fzf_version, a:1) >= 0
let s:checked[a:1] = 1
if s:compare_versions(fzf_version, min_version) >= 0
let s:checked[min_version] = 1
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 = {}
unlet s:exec
redraw
call fzf#install()
return fzf#exec(a:1, 1)
return fzf#exec(min_version, 1)
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

Expand Down

0 comments on commit d06c5ab

Please sign in to comment.