Skip to content

Commit b947b76

Browse files
committed
fix(live_grep): with $FZF_QUERY field index (closes #2343)
1 parent 96ac1b5 commit b947b76

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

lua/fzf-lua/make_entry.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,16 @@ end
217217
---@return string cmd
218218
M.lgrep = function(s, opts)
219219
-- can be nil when called as fzf initial command
220-
local query = s[1] or ""
220+
local query, no_esc = (function()
221+
-- $FZF_QUERY sends query args as table (#2343)
222+
if #s > 1 then
223+
return table.concat(vim.tbl_map(function(x) return libuv.shellescape(x) end, s), " "), 2
224+
else
225+
return (s[1] or ""), true
226+
end
227+
end)()
221228
opts.no_esc = nil
222-
local cmd0 = FzfLua.make_entry.get_grep_cmd(opts, query, true)
229+
local cmd0 = FzfLua.make_entry.get_grep_cmd(opts, query, no_esc)
223230
if not opts.exec_empty_query and #query == 0 then
224231
cmd0 = FzfLua.utils.shell_nop()
225232
elseif opts.silent_fail ~= false then

0 commit comments

Comments
 (0)