@@ -315,6 +315,8 @@ M.fzf = function(contents, opts)
315315 opts = config .normalize_opts (opts or {}, {})
316316 if not opts then return end
317317 end
318+ -- Store contents for unhide
319+ opts ._contents = contents
318320 -- flag used to print the query on stdout line 1
319321 -- later to be removed from the result by M.fzf()
320322 -- this provides a solution for saving the query
@@ -371,7 +373,8 @@ M.fzf = function(contents, opts)
371373 -- fzf 0.40 added 'zero' event for when there's no match
372374 -- clears the preview when there are no matching entries
373375 if utils .has (opts , " fzf" , { 0 , 40 }) and previewer .zero then
374- utils .map_set (opts , " keymap.fzf.zero" , previewer :zero ())
376+ table.insert (opts ._fzf_cli_args , " --bind="
377+ .. libuv .shellescape (" zero:+" .. previewer :zero ()))
375378 end
376379 if type (previewer .preview_window ) == " function" then
377380 -- do we need to override the preview_window args?
@@ -751,8 +754,14 @@ M.build_fzf_cli = function(opts, fzf_win)
751754 end
752755 end
753756 for _ , o in ipairs ({ " fzf_args" , " fzf_raw_args" , " fzf_cli_args" , " _fzf_cli_args" }) do
754- if opts [o ] then
755- table.insert (cli_args , type (opts [o ]) == " table" and opts [o ] or tostring (opts [o ]))
757+ local args = opts [o ]
758+ if args then
759+ if type (args ) ~= " table" then
760+ args = { tostring (args ) }
761+ end
762+ for _ , arg in ipairs (args ) do
763+ table.insert (cli_args , arg )
764+ end
756765 end
757766 end
758767 return cli_args
@@ -1087,19 +1096,11 @@ M.convert_reload_actions = function(reload_cmd, opts)
10871096 }
10881097 end
10891098 end
1090- opts .keymap .fzf .load = (function ()
1091- -- NOTE: this fixes existence of both load as function and rebind, e.g. git_status with:
1092- -- setup({ keymap = { fzf = { true, load = function() _G._fzf_load_called = true end } } }
1093- if type (opts .keymap .fzf .load ) == " function" then
1094- opts .keymap .fzf .load = " execute-silent:"
1095- .. shell .stringify_data (opts .keymap .fzf .load , opts , nil , true )
1096- end
1097- if rebind and type (opts .keymap .fzf .load ) == " string" then
1098- return string.format (" %s+%s" , rebind , opts .keymap .fzf .load )
1099- else
1100- return rebind or opts .keymap .fzf .load
1101- end
1102- end )()
1099+
1100+ if rebind then
1101+ table.insert (opts ._fzf_cli_args ,
1102+ " --bind=" .. libuv .shellescape (string.format (" load:+%s" , rebind )))
1103+ end
11031104 return opts
11041105end
11051106
@@ -1218,20 +1219,20 @@ M.setup_fzf_interactive_flags = function(command, fzf_field_index, opts)
12181219 opts .fzf_opts [" --query" ] = nil
12191220 opts .query = nil
12201221 -- setup as interactive
1221- opts ._fzf_cli_args = string.format (" --interactive --cmd %s" ,
1222- libuv .shellescape (no_query_condi .. reload_command ))
1222+ table.insert ( opts ._fzf_cli_args , string.format (" --interactive --cmd %s" ,
1223+ libuv .shellescape (no_query_condi .. reload_command )))
12231224 else
12241225 opts .fzf_opts [" --disabled" ] = true
12251226 opts .fzf_opts [" --query" ] = opts .query
12261227 -- OR with true to avoid fzf's "Command failed:" message
12271228 if opts .silent_fail ~= false then
12281229 reload_command = reload_command .. " || " .. utils .shell_nop ()
12291230 end
1230- opts ._fzf_cli_args = string.format ( " --bind=%s " , libuv . shellescape (
1231- string.format (" change:reload:%s%s" , no_query_condi , reload_command )))
1231+ table.insert ( opts ._fzf_cli_args , " --bind="
1232+ .. libuv . shellescape ( string.format (" change:+ reload:%s%s" , no_query_condi , reload_command )))
12321233 if utils .has (opts , " fzf" , { 0 , 35 }) then
1233- opts . _fzf_cli_args = opts ._fzf_cli_args .. string.format ( " --bind=%s " ,
1234- libuv .shellescape (string.format (" start:reload:%s%s" , no_query_condi , reload_command )))
1234+ table.insert ( opts ._fzf_cli_args , " --bind="
1235+ .. libuv .shellescape (string.format (" start:+ reload:%s%s" , no_query_condi , reload_command )))
12351236 end
12361237 end
12371238
0 commit comments