Skip to content

Commit

Permalink
fix(reload): limit reload action UX to fzf 0.36 (closes #735)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhagwan committed Apr 22, 2023
1 parent 8cee7f5 commit 64c980d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lua/fzf-lua/core.lua
Expand Up @@ -749,6 +749,12 @@ M.convert_reload_actions = function(reload_cmd, opts)
if opts._is_skim or not opts.reload_actions then
return opts
end
-- Does not work with fzf version < 0.36, fzf fails with
-- "error 2: bind action not specified:" (#735)
local version = utils.fzf_version(opts)
if version < 0.36 then
return opts
end
for k, v in pairs(opts.actions) do
local action = type(v) == "function" and v or type(v) == "table" and v[1]
if type(action) == "function" and opts.reload_actions[action] then
Expand Down
5 changes: 5 additions & 0 deletions lua/fzf-lua/utils.lua
Expand Up @@ -806,6 +806,11 @@ function M.neovim_bind_to_fzf(key)
return key
end

function M.fzf_version(opts)
local out = M.io_system({ opts.fzf_bin or "fzf", "--version" })
return tonumber(out:match("(%d+.%d+)."))
end

function M.git_version()
local out = M.io_system({ "git", "--version" })
return tonumber(out:match("(%d+.%d+)."))
Expand Down

0 comments on commit 64c980d

Please sign in to comment.