Skip to content
Myr

[vim] Improve binary detection

Before adoption: this commit came in with the history the project adopted, so no landing records it.

/cc @alerque - Ask for user confirmation before running `install --bin` - Removed `s:fzf_rb` since `install --bin` will create a wrapper executable that just runs Ruby version on the platforms where prebuilt binaries are not available.

authored by Junegunn Choi · committed by Junegunn Choi · parent 3d26b53 · Browse files · 1 file+15 added−24 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+15 added−24 removed

  • other:+15 added−24 removed

1 file+15 added−24 removed

modified:plugin/fzf.vim+15 added-24 removed
23 unmodified lines
24let s:default_height = '40%'25let s:fzf_go = expand('<sfile>:h:h').'/bin/fzf'26let s:install = expand('<sfile>:h:h').'/install'27let s:installed = 028let s:fzf_rb = expand('<sfile>:h:h').'/fzf'28let s:fzf_tmux = expand('<sfile>:h:h').'/bin/fzf-tmux'2930let s:cpo_save = &cpo31set cpo&vim
1 unmodified line
33function! s:fzf_exec()34 if !exists('s:exec')35 if executable(s:fzf_go)36 let s:exec = s:fzf_go37 elseif executable('fzf')38 let s:exec = 'fzf'39 elseif !s:installed && executable(s:install) &&40 \ input('fzf executable not found. Download binary? (y/n) ') =~? '^y'41 redraw42 echo43 echohl WarningMsg44 echo 'Downloading fzf binary. Please wait ...'45 echohl None46 let s:installed = 147 call system(s:install.' --bin')48 return s:fzf_exec()49 else39 let path = split(system('which fzf 2> /dev/null'), '\n')40 if !v:shell_error && !empty(path)41 let s:exec = path[0]42 elseif !s:installed && executable(s:install)43 echohl WarningMsg44 echo 'Downloading fzf binary. Please wait ...'45 echohl None46 let s:installed = 147 call system(s:install.' --bin')48 return s:fzf_exec()49 elseif executable(s:fzf_rb)50 let s:exec = s:fzf_rb51 else52 call system('type fzf')53 if v:shell_error54 throw 'fzf executable not found'55 else56 let s:exec = 'fzf'57 endif58 endif50 redraw51 throw 'fzf executable not found'52 endif60 return s:exec61 else62 return s:exec53 endif54 return s:exec55endfunction5657function! s:tmux_enabled()58 if has('gui_running')
310 unmodified lines