Skip to content
Myr

[vim] Use install.ps1 to download binary on Windows

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Credits to @jiangjianshan

authored by Junegunn Choi · committed by Junegunn Choi · parent f39cf6d · Browse files · 1 file+32 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+32 added−13 removed

  • other:+32 added−13 removed

1 file+32 added−13 removed

modified:plugin/fzf.vim+32 added-13 removed
117 unmodified lines
118let s:default_layout = { 'down': '~40%' }119let s:layout_keys = ['window', 'up', 'down', 'left', 'right']120let s:fzf_go = s:base_dir.'/bin/fzf'121let s:fzf_tmux = s:base_dir.'/bin/fzf-tmux'122let s:install = s:base_dir.'/install'122let s:installed = 0123124let s:cpo_save = &cpo125set cpo&vim126127function! s:download_bin()128 if s:installed129 return 0130 endif131132 if s:is_win && !has('win32unix')133 let script = s:base_dir.'/install.ps1'134 if !filereadable(script)135 return 0136 endif137 let script = 'powershell -ExecutionPolicy Bypass -file ' . script138 else139 let script = s:base_dir.'/install'140 if !executable(script)141 return 0142 endif143 let script .= ' --bin'144 endif145146 if input('fzf executable not found. Download binary? (y/n) ') !~? '^y'147 return 0148 end149150 redraw151 echo152 call s:warn('Downloading fzf binary. Please wait ...')153 let s:installed = 1154 call system(script)155 return v:shell_error == 0156endfunction157158function! s:fzf_exec()159 if !exists('s:exec')160 if executable(s:fzf_go)161 let s:exec = s:fzf_go162 elseif executable('fzf')163 let s:exec = 'fzf'134 elseif s:is_win && !has('win32unix')135 call s:warn('fzf executable not found.')136 call s:warn('Download fzf binary for Windows from https://github.com/junegunn/fzf-bin/releases/')137 call s:warn('and place it as '.s:base_dir.'\bin\fzf.exe')138 throw 'fzf executable not found'139 elseif !s:installed && executable(s:install) &&140 \ input('fzf executable not found. Download binary? (y/n) ') =~? '^y'141 redraw142 echo143 call s:warn('Downloading fzf binary. Please wait ...')144 let s:installed = 1145 call system(s:install.' --bin')164 elseif s:download_bin()165 return s:fzf_exec()166 else167 redraw168 throw 'fzf executable not found'
780 unmodified lines