|
|
@ -119,40 +119,30 @@ let s:default_layout = { 'down': '~40%' }
|
|
|
|
let s:layout_keys = ['window', 'up', 'down', 'left', 'right']
|
|
|
|
let s:layout_keys = ['window', 'up', 'down', 'left', 'right']
|
|
|
|
let s:fzf_go = s:base_dir.'/bin/fzf'
|
|
|
|
let s:fzf_go = s:base_dir.'/bin/fzf'
|
|
|
|
let s:fzf_tmux = s:base_dir.'/bin/fzf-tmux'
|
|
|
|
let s:fzf_tmux = s:base_dir.'/bin/fzf-tmux'
|
|
|
|
let s:installed = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let s:cpo_save = &cpo
|
|
|
|
let s:cpo_save = &cpo
|
|
|
|
set cpo&vim
|
|
|
|
set cpo&vim
|
|
|
|
|
|
|
|
|
|
|
|
function! s:download_bin()
|
|
|
|
function! fzf#install()
|
|
|
|
if s:installed
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if s:is_win && !has('win32unix')
|
|
|
|
if s:is_win && !has('win32unix')
|
|
|
|
let script = s:base_dir.'/install.ps1'
|
|
|
|
let script = s:base_dir.'/install.ps1'
|
|
|
|
if !filereadable(script)
|
|
|
|
if !filereadable(script)
|
|
|
|
return 0
|
|
|
|
throw script.' not found'
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
let script = 'powershell -ExecutionPolicy Bypass -file ' . script
|
|
|
|
let script = 'powershell -ExecutionPolicy Bypass -file ' . script
|
|
|
|
else
|
|
|
|
else
|
|
|
|
let script = s:base_dir.'/install'
|
|
|
|
let script = s:base_dir.'/install'
|
|
|
|
if !executable(script)
|
|
|
|
if !executable(script)
|
|
|
|
return 0
|
|
|
|
throw script.' not found'
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
let script .= ' --bin'
|
|
|
|
let script .= ' --bin'
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
if input('fzf executable not found. Download binary? (y/n) ') !~? '^y'
|
|
|
|
call s:warn('Running fzf installer ...')
|
|
|
|
return 0
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
redraw
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
call s:warn('Downloading fzf binary. Please wait ...')
|
|
|
|
|
|
|
|
let s:installed = 1
|
|
|
|
|
|
|
|
call system(script)
|
|
|
|
call system(script)
|
|
|
|
return v:shell_error == 0
|
|
|
|
if v:shell_error
|
|
|
|
|
|
|
|
throw 'Failed to download fzf: '.script
|
|
|
|
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
function! s:fzf_exec()
|
|
|
|
function! s:fzf_exec()
|
|
|
@ -161,7 +151,10 @@ function! s:fzf_exec()
|
|
|
|
let s:exec = s:fzf_go
|
|
|
|
let s:exec = s:fzf_go
|
|
|
|
elseif executable('fzf')
|
|
|
|
elseif executable('fzf')
|
|
|
|
let s:exec = 'fzf'
|
|
|
|
let s:exec = 'fzf'
|
|
|
|
elseif s:download_bin()
|
|
|
|
elseif input('fzf executable not found. Download binary? (y/n) ') =~? '^y'
|
|
|
|
|
|
|
|
redraw
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
call fzf#install()
|
|
|
|
return s:fzf_exec()
|
|
|
|
return s:fzf_exec()
|
|
|
|
else
|
|
|
|
else
|
|
|
|
redraw
|
|
|
|
redraw
|
|
|
|