diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2015-04-16 22:24:12 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-04-16 22:24:12 +0900 |
commit | a30908c66a32b57ad91cd1f5c993b8017c0699a5 (patch) | |
tree | 0f34192b53bc2833ef143387023f75036dada863 /plugin | |
parent | f9225f98e7a4ce1678956b0263ec3b994ada50dd (diff) |
[vim] Automatically download Go binary when not found
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/fzf.vim | 11 |
1 files changed, 10 insertions, 1 deletions
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('<sfile>:h:h').'/bin/fzf' +let s:install = expand('<sfile>:h:h').'/install' +let s:installed = 0 let s:fzf_rb = expand('<sfile>:h:h').'/fzf' let s:fzf_tmux = expand('<sfile>: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) : {} |