mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-25 06:07:42 +00:00
Improve how vim plugin finds fzf executable
This avoids the problem in which :FZF command silently fails when fzf executable cannot be found in $PATH of the hosting tmux server.
This commit is contained in:
parent
f7b52d2541
commit
06ab399497
@ -33,17 +33,24 @@ set cpo&vim
|
||||
|
||||
function! s:fzf_exec()
|
||||
if !exists('s:exec')
|
||||
call system('type fzf')
|
||||
if v:shell_error
|
||||
let s:exec = executable(s:fzf_go) ?
|
||||
\ s:fzf_go : (executable(s:fzf_rb) ? s:fzf_rb : '')
|
||||
if executable(s:fzf_go)
|
||||
let s:exec = s:fzf_go
|
||||
else
|
||||
let s:exec = 'fzf'
|
||||
let path = split(system('which fzf 2> /dev/null'), '\n')
|
||||
if !v:shell_error && !empty(path)
|
||||
let s:exec = path[0]
|
||||
elseif executable(s:fzf_rb)
|
||||
let s:exec = s:fzf_rb
|
||||
else
|
||||
call system('type fzf')
|
||||
if v:shell_error
|
||||
throw 'fzf executable not found'
|
||||
else
|
||||
let s:exec = 'fzf'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
return s:fzf_exec()
|
||||
elseif empty(s:exec)
|
||||
unlet s:exec
|
||||
throw 'fzf executable not found'
|
||||
return s:exec
|
||||
else
|
||||
return s:exec
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user