Disable preview window if bash is not found

Fix #1039
This commit is contained in:
Junegunn Choi
2020-06-07 10:13:35 +09:00
parent 5aa5977d74
commit 16e3efbcb1

View File

@@ -44,6 +44,7 @@ if s:is_win
endif
let s:wide = 120
let s:warned = 0
function! s:extend_opts(dict, eopts, prepend)
if empty(a:eopts)
@@ -76,9 +77,6 @@ endfunction
" [[options to wrap], [preview window expression], [toggle-preview keys...]]
function! fzf#vim#with_preview(...)
let bash_path = exepath('bash')
if empty(bash_path)
throw 'bash is not in PATH'
endif
let is_wsl_bash = bash_path =~? 'Windows[/\\]system32[/\\]bash.exe$'
" Default options
let options = {}
@@ -92,6 +90,14 @@ function! fzf#vim#with_preview(...)
call remove(args, 0)
endif
if empty(bash_path)
if !s:warned
call s:warn('Preview window not supported (bash not found in PATH)')
let s:warned = 1
endif
return options
endif
" Placeholder expression (TODO/TBD: undocumented)
let placeholder = get(options, 'placeholder', '{}')