From 16e3efbcb100981e9c6c0adbf6287d4a59d022f3 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 7 Jun 2020 10:13:35 +0900 Subject: [PATCH] Disable preview window if bash is not found Fix #1039 --- autoload/fzf/vim.vim | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index fb37c8e..039b085 100644 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -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', '{}')