From 91ec17b4fd0d810599f054eef08db967a0457fbf Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sat, 10 Feb 2024 21:25:38 +0100 Subject: [PATCH] Allow setting --preview-window to false to not override FZF defaults Currently when fzf_opts["--preview-window"] is set to false, it works as long as opts.preview_offset is not set. But this is set for grep by default so it throws error. This checks if --preview-window is set before adding preview offset to it. --- lua/fzf-lua/core.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/fzf-lua/core.lua b/lua/fzf-lua/core.lua index f5c2f1ef..3f8a86fa 100644 --- a/lua/fzf-lua/core.lua +++ b/lua/fzf-lua/core.lua @@ -502,7 +502,7 @@ M.build_fzf_cli = function(opts) if opts.fzf_opts["--preview-window"] == nil then opts.fzf_opts["--preview-window"] = M.preview_window(opts) end - if opts.preview_offset and #opts.preview_offset > 0 then + if opts.fzf_opts["--preview-window"] and opts.preview_offset and #opts.preview_offset > 0 then opts.fzf_opts["--preview-window"] = opts.fzf_opts["--preview-window"] .. ":" .. opts.preview_offset end