Skip to content

Commit

Permalink
feat(actions): added header property (closes #1351)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhagwan committed Jul 30, 2024
1 parent a36f02f commit 81e7345
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lua/fzf-lua/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -970,16 +970,19 @@ M.set_header = function(opts, hdr_tbl)
local ret = {}
for k, v in pairs(opts.actions) do
local action = type(v) == "function" and v or type(v) == "table" and (v.fn or v[1])
if type(action) == "function" and defs[action] then
local def = defs[action]
local to = def[1]
local def, to = nil, type(v) == "table" and v.header
if not to and type(action) == "function" and defs[action] then
def = defs[action]
to = def[1]
end
if to then
if type(to) == "function" then
to = to(o)
end
table.insert(ret, def.pos or #ret + 1,
table.insert(ret, def and def.pos or #ret + 1,
string.format("<%s> to %s",
utils.ansi_from_hl(opts.hls.header_bind, k),
utils.ansi_from_hl(opts.hls.header_text, to)))
utils.ansi_from_hl(opts.hls.header_text, tostring(to))))
end
end
-- table.concat fails if the table indexes aren't consecutive
Expand Down

0 comments on commit 81e7345

Please sign in to comment.