[vim] Download instruction for Windows
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Junegunn Choi · committed by Junegunn Choi · parent e514739 · Browse files · 1 file·+15 added−8 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+15 added−8 removed
- other:+15 added−8 removed
Provenance
- Commit
02ceae1- Tree
ad9f6e4- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
e514739
1 file changed+15 added−8 removed
modified:plugin/fzf.vim+15 added-8 removed
26 unmodified lines27 let g:loaded_fzf = 128 29 let s:default_layout = { 'down': '~40%' }30 let s:layout_keys = ['window', 'up', 'down', 'left', 'right']31-let s:fzf_go = expand('<sfile>:h:h').'/bin/fzf'32-let s:install = expand('<sfile>:h:h').'/install'31+let s:is_win = has('win32') || has('win64')32+let s:base_dir = expand('<sfile>:h:h')33+let s:fzf_go = s:base_dir.'/bin/fzf'34+let s:fzf_tmux = s:base_dir.'/bin/fzf-tmux'35+let s:install = s:base_dir.'/install'36 let s:installed = 034-let s:fzf_tmux = expand('<sfile>:h:h').'/bin/fzf-tmux'37 38 let s:cpo_save = &cpo39 set cpo&vim40 2 unmodified lines43 if executable(s:fzf_go)44 let s:exec = s:fzf_go45 elseif executable('fzf')46 let s:exec = 'fzf'47+ elseif s:is_win48+ call s:warn('fzf executable not found.')49+ call s:warn('Download fzf binary for Windows from https://github.com/junegunn/fzf-bin/releases/')50+ call s:warn('and place it as '.s:base_dir.'\bin\fzf.exe')51+ throw 'fzf executable not found'52 elseif !s:installed && executable(s:install) &&53 \ input('fzf executable not found. Download binary? (y/n) ') =~? '^y'54 redraw55 echo196 unmodified lines252 return opts253 endfunction254 255 function! fzf#shellescape(path)249- if has('win32') || has('win64')256+ if s:is_win257 let shellslash = &shellslash258 try259 set noshellslash260 return shellescape(a:path)8 unmodified lines269 try270 let oshell = &shell271 let useshellslash = &shellslash272 266- if has('win32') || has('win64')273+ if s:is_win274 set shell=cmd.exe275 set noshellslash276 else277 set shell=sh35 unmodified lines313 endif314 315 let prefer_tmux = get(g:, 'fzf_prefer_tmux', 0)316 let use_height = has_key(dict, 'down') &&310- \ !(has('nvim') || has('win32') || has('win64') || s:present(dict, 'up', 'left', 'right')) &&317+ \ !(has('nvim') || s:is_win || s:present(dict, 'up', 'left', 'right')) &&318 \ executable('tput') && filereadable('/dev/tty')319 let use_term = has('nvim')320 let use_tmux = (!use_height && !use_term || prefer_tmux) && s:tmux_enabled() && s:splittable(dict)321 if prefer_tmux && use_tmux1 unmodified line323 let use_term = 0324 endif325 if use_height326 let optstr .= ' --height='.s:calc_size(&lines, dict.down, dict)320- else327+ elseif use_term328 let optstr .= ' --no-height'329 endif330 let command = prefix.(use_tmux ? s:fzf_tmux(dict) : fzf_exec).' '.optstr.' > '.temps.result331 79 unmodified lines411 \ synIDattr(hlID("Normal"), "bg"), synIDattr(hlID("Normal"), "fg"),412 \ &columns, &lines/2, getwinposx(), getwinposy())413 endfunction414 unlet! s:launcher408-if has('win32') || has('win64')415+if s:is_win416 let s:launcher = '%s'417 else418 let s:launcher = function('s:xterm_launcher')419 endif261 unmodified lines