From a30908c66a32b57ad91cd1f5c993b8017c0699a5 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 16 Apr 2015 22:24:12 +0900 Subject: [vim] Automatically download Go binary when not found --- plugin/fzf.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'plugin') diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 99aa3009..7015e28f 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -24,6 +24,8 @@ let s:default_height = '40%' let s:launcher = 'xterm -e bash -ic %s' let s:fzf_go = expand(':h:h').'/bin/fzf' +let s:install = expand(':h:h').'/install' +let s:installed = 0 let s:fzf_rb = expand(':h:h').'/fzf' let s:fzf_tmux = expand(':h:h').'/bin/fzf-tmux' @@ -34,6 +36,13 @@ function! s:fzf_exec() if !exists('s:exec') if executable(s:fzf_go) let s:exec = s:fzf_go + elseif !s:installed && executable(s:install) + echohl WarningMsg + echo 'Downloading fzf binary. Please wait ...' + echohl None + let s:installed = 1 + call system(s:install.' --bin') + return s:fzf_exec() else let path = split(system('which fzf 2> /dev/null'), '\n') if !v:shell_error && !empty(path) @@ -99,7 +108,7 @@ function! fzf#run(...) abort if has('nvim') && bufexists('[FZF]') echohl WarningMsg echomsg 'FZF is already running!' - echohl NONE + echohl None return [] endif let dict = exists('a:1') ? s:upgrade(a:1) : {} -- cgit v1.2.3