@@ -175,8 +175,7 @@ M.fzf_live = function(contents, opts)
175175 opts .fn_reload = shell .stringify (contents , opts )
176176 local fzf_field_index = M .fzf_field_index (opts )
177177 local cmd = M .expand_query (opts .fn_reload , fzf_field_index )
178- opts = M .setup_fzf_interactive_flags (cmd , fzf_field_index , opts )
179- contents = opts .__fzf_init_cmd
178+ contents , opts = M .setup_fzf_interactive_flags (cmd , fzf_field_index , opts )
180179 return M .fzf_wrap (contents , opts )
181180end
182181
@@ -192,7 +191,7 @@ M.fzf_resume = function(opts)
192191 opts = M .set_header (opts , opts .headers or {})
193192 opts .cwd = opts .cwd and libuv .expand (opts .cwd ) or nil
194193 opts .__resuming = true
195- M .fzf_exec (config .__resume_data .contents , config .__resume_data .opts )
194+ M .fzf_wrap (config .__resume_data .contents , config .__resume_data .opts )
196195end
197196
198197--- @param contents string ?
@@ -1148,7 +1147,7 @@ end
11481147--- @param command string
11491148--- @param fzf_field_index string
11501149--- @param opts table
1151- --- @return table
1150+ --- @return string ?, table
11521151M .setup_fzf_interactive_flags = function (command , fzf_field_index , opts )
11531152 -- query cannot be 'nil'
11541153 opts .query = opts .query or " "
@@ -1190,8 +1189,6 @@ M.setup_fzf_interactive_flags = function(command, fzf_field_index, opts)
11901189 )
11911190
11921191 if opts ._is_skim then
1193- -- skim interactive mode does not need a piped command
1194- opts .__fzf_init_cmd = nil
11951192 opts .prompt = opts .__prompt or opts .prompt or opts .fzf_opts [" --prompt" ]
11961193 if opts .prompt then
11971194 opts .fzf_opts [" --prompt" ] = opts .prompt :match (" [^%*]+" )
@@ -1215,10 +1212,6 @@ M.setup_fzf_interactive_flags = function(command, fzf_field_index, opts)
12151212 opts ._fzf_cli_args = string.format (" --interactive --cmd %s" ,
12161213 libuv .shellescape (no_query_condi .. reload_command ))
12171214 else
1218- -- **send an empty table to avoid running $FZF_DEFAULT_COMMAND
1219- -- The above seems to create a hang in some systems
1220- -- use `true` as $FZF_DEFAULT_COMMAND instead (#510)
1221- opts .__fzf_init_cmd = utils .shell_nop ()
12221215 if opts .exec_empty_query or (opts .query and # opts .query > 0 ) then
12231216 local q = not utils .__IS_WINDOWS and opts .query
12241217 or libuv .escape_fzf (opts .query , utils .has (opts , " fzf" , { 0 , 52 }) and 0.52 or 0 )
@@ -1234,9 +1227,20 @@ M.setup_fzf_interactive_flags = function(command, fzf_field_index, opts)
12341227 end
12351228 opts ._fzf_cli_args = string.format (" --bind=%s" , libuv .shellescape (
12361229 string.format (" change:reload:%s%s" , no_query_condi , reload_command )))
1230+ if utils .has (opts , " fzf" , { 0 , 35 }) then
1231+ opts ._fzf_cli_args = opts ._fzf_cli_args .. string.format (" --bind=%s" ,
1232+ libuv .shellescape (string.format (" start:reload:%s%s" , no_query_condi , reload_command )))
1233+ -- NOTE: not needed since we deprecated fzf < v0.35
1234+ -- elseif opts.exec_empty_query or (opts.query and #opts.query > 0) then
1235+ -- local q = not utils.__IS_WINDOWS and opts.query
1236+ -- or libuv.escape_fzf(opts.query, utils.has(opts, "fzf", { 0, 52 }) and 0.52 or 0)
1237+ -- -- gsub doesn't like single % on rhs
1238+ -- local escaped_q = libuv.shellescape(q):gsub("%%", "%%%%")
1239+ -- opts.__fzf_init_cmd = initial_command:gsub(fzf_field_index, escaped_q)
1240+ end
12371241 end
12381242
1239- return opts
1243+ return utils . shell_nop (), opts
12401244end
12411245
12421246-- query placeholder for "live" queries
0 commit comments