Skip to content
Myr

[vim] Defer `type fzf` to reduce startup time

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 b0f80b6 · Browse files · 1 file+21 added−11 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+21 added−11 removed

  • other:+21 added−11 removed

1 file+21 added−11 removed

modified:plugin/fzf.vim+21 added-11 removed
23 unmodified lines
24let s:min_tmux_width = 1025let s:min_tmux_height = 326let s:default_tmux_height = '40%'27let s:launcher = 'xterm -e bash -ic %s'28let s:fzf_rb = expand('<sfile>:h:h').'/fzf'2930let s:cpo_save = &cpo31set cpo&vim3232call system('type fzf')33if v:shell_error34 let s:fzf_rb = expand('<sfile>:h:h').'/fzf'35 if executable(s:fzf_rb)36 let s:exec = s:fzf_rb33function! s:fzf_exec()34 if !exists('s:exec')35 call system('type fzf')36 if v:shell_error37 let s:exec = executable(s:fzf_rb) ? s:fzf_rb : ''38 else39 let s:exec = 'fzf'40 endif41 return s:fzf_exec()42 elseif empty(s:exec)43 unlet s:exec44 throw 'fzf executable not found'45 else38 echoerr 'fzf executable not found'39 finish46 return s:exec47 endif41else42 let s:exec = 'fzf'43endif48endfunction4950function! s:tmux_enabled()51 if has('gui_running')52 return 0
22 unmodified lines
75function! fzf#run(...) abort76 let dict = exists('a:1') ? a:1 : {}77 let temps = { 'result': tempname() }78 let optstr = get(dict, 'options', '')79 try80 let fzf_exec = s:fzf_exec()81 catch82 throw v:exception83 endtry8485 if has_key(dict, 'source')86 let source = dict.source87 let type = type(source)
8 unmodified lines
96 endif97 else98 let prefix = ''99 endif90 let command = prefix.s:exec.' '.optstr.' > '.temps.result100 let command = prefix.fzf_exec.' '.optstr.' > '.temps.result101102 if s:tmux_enabled() && s:tmux_splittable(dict)103 return s:execute_tmux(dict, command, temps)104 else
135 unmodified lines