mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2025-04-05 16:51:50 +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()
|
function! s:fzf_exec()
|
||||||
if !exists('s:exec')
|
if !exists('s:exec')
|
||||||
call system('type fzf')
|
if executable(s:fzf_go)
|
||||||
if v:shell_error
|
let s:exec = s:fzf_go
|
||||||
let s:exec = executable(s:fzf_go) ?
|
|
||||||
\ s:fzf_go : (executable(s:fzf_rb) ? s:fzf_rb : '')
|
|
||||||
else
|
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
|
endif
|
||||||
return s:fzf_exec()
|
return s:exec
|
||||||
elseif empty(s:exec)
|
|
||||||
unlet s:exec
|
|
||||||
throw 'fzf executable not found'
|
|
||||||
else
|
else
|
||||||
return s:exec
|
return s:exec
|
||||||
endif
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user