diff --git a/install.ps1 b/install.ps1 index f29ed6b2..773421fe 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1,11 +1,5 @@ $version="0.23.1" -if ([Environment]::Is64BitProcess) { - $binary_arch="amd64" -} else { - $binary_arch="386" -} - $fzf_base=Split-Path -Parent $MyInvocation.MyCommand.Definition function check_binary () { @@ -68,6 +62,6 @@ function download { check_binary >$null } -download "fzf-$version-windows_$binary_arch.zip" +download "fzf-$version-windows_amd64.zip" Write-Host 'For more information, see: https://github.com/junegunn/fzf' diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 671f4537..1af0597e 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -154,7 +154,20 @@ function! fzf#install() endif endfunction -function! fzf#exec() +function! s:version_requirement(val, min) + let val = split(a:val, '\.') + let min = split(a:min, '\.') + for idx in range(0, len(min) - 1) + let v = get(val, idx, 0) + if v < min[idx] | return 0 + elseif v > min[idx] | return 1 + endif + endfor + return 1 +endfunction + +let s:checked = {} +function! fzf#exec(...) if !exists('s:exec') if executable(s:fzf_go) let s:exec = s:fzf_go @@ -169,6 +182,26 @@ function! fzf#exec() throw 'fzf executable not found' endif endif + + if a:0 && !has_key(s:checked, a:1) + let command = s:exec . ' --version' + let output = systemlist(command) + if v:shell_error || empty(output) + throw printf('Failed to run "%s": %s', command, output) + endif + let fzf_version = matchstr(output[0], '[0-9.]\+') + if s:version_requirement(fzf_version, a:1) + let s:checked[a:1] = 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' + redraw + call fzf#install() + return fzf#exec(a:1, 1) + else + throw printf('You need to upgrade fzf (required: %s or above)', a:1) + endif + endif + return s:exec endfunction @@ -671,6 +704,8 @@ function! s:border_opt(window) return '' endif + " For --border styles, we need fzf 0.24.0 or above + call fzf#exec('0.24.0') let opt = ' --border=' . style if has_key(a:window, 'highlight') let color = s:get_color('fg', a:window.highlight) diff --git a/src/constants.go b/src/constants.go index 9a5b8fa3..ca181ed0 100644 --- a/src/constants.go +++ b/src/constants.go @@ -10,7 +10,7 @@ import ( const ( // Current version - version = "0.23.1" + version = "0.24.0" // Core coordinatorDelayMax time.Duration = 100 * time.Millisecond