diff --git a/lua/fzf-lua/config.lua b/lua/fzf-lua/config.lua index 7bbddfe..48ac393 100644 --- a/lua/fzf-lua/config.lua +++ b/lua/fzf-lua/config.lua @@ -768,6 +768,13 @@ function M.normalize_opts(opts, defaults) not executable(opts.fzf_bin, utils.warn, "fallback to 'fzf'.") then -- default|fallback to fzf opts.fzf_bin = "fzf" + -- try fzf plugin if fzf is not installed globally + if vim.fn.executable(opts.fzf_bin) ~= 1 then + local ok, fzf_plug = pcall(vim.api.nvim_call_function, "fzf#exec", {}) + if ok and fzf_plug then + opts.fzf_bin = fzf_plug + end + end if not executable(opts.fzf_bin, utils.err, "aborting. Please make sure 'fzf' is in installed.") then return nil diff --git a/lua/fzf-lua/core.lua b/lua/fzf-lua/core.lua index 5d85f5e..048fb5a 100644 --- a/lua/fzf-lua/core.lua +++ b/lua/fzf-lua/core.lua @@ -52,6 +52,7 @@ M.fzf = function(opts, contents) -- normalize with globals if not already normalized if not opts._normalized then opts = config.normalize_opts(opts, {}) + if not opts then return end end if opts.fn_pre_win then opts.fn_pre_win(opts)