Skip to content
Myr

Improve how vim plugin finds fzf executable

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

This avoids the problem in which :FZF command silently fails when fzf executable cannot be found in $PATH of the hosting tmux server.

authored by Junegunn Choi · committed by Junegunn Choi · parent f7b52d2 · Browse files · 1 file+16 added−9 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+16 added−9 removed

  • other:+16 added−9 removed

1 file+16 added−9 removed

modified:plugin/fzf.vim+16 added-9 removed
31 unmodified lines
32set cpo&vim3334function! s:fzf_exec()35 if !exists('s:exec')36 call system('type fzf')37 if v:shell_error38 let s:exec = executable(s:fzf_go) ?39 \ s:fzf_go : (executable(s:fzf_rb) ? s:fzf_rb : '')36 if executable(s:fzf_go)37 let s:exec = s:fzf_go38 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 executable(s:fzf_rb)43 let s:exec = s:fzf_rb44 else45 call system('type fzf')46 if v:shell_error47 throw 'fzf executable not found'48 else41 let s:exec = 'fzf'49 let s:exec = 'fzf'50 endif51 endif52 endif43 return s:fzf_exec()44 elseif empty(s:exec)45 unlet s:exec46 throw 'fzf executable not found'53 return s:exec54 else55 return s:exec56 endif57endfunction
201 unmodified lines