How can i send picker selection to quickfix list, but append #1897
Answered
by
dpetka2001
jacobrreed
asked this question in
Q&A
-
If i already have quickfix list populated, and open picker again, select multiple items and send to quickfix list, it erases old list and replaces it with new selections, how can I append instead? |
Beta Was this translation helpful? Give feedback.
Answered by
dpetka2001
May 20, 2025
Replies: 1 comment 1 reply
-
You can't as it's currently implemented. You can however implement a custom action of yours with most of the code shown here. I believe this should work return {
{
"folke/snacks.nvim",
opts = {
picker = {
actions = {
qflist_append = function(picker)
picker:close()
local sel = picker:selected()
local items = #sel > 0 and sel or picker:items()
local qf = {} ---@type vim.quickfix.entry[]
for _, item in ipairs(items) do
qf[#qf + 1] = {
filename = Snacks.picker.util.path(item),
bufnr = item.buf,
lnum = item.pos and item.pos[1] or 1,
col = item.pos and item.pos[2] + 1 or 1,
end_lnum = item.end_pos and item.end_pos[1] or nil,
end_col = item.end_pos and item.end_pos[2] + 1 or nil,
text = item.line or item.comment or item.label or item.name or item.detail or item.text,
pattern = item.search,
valid = true,
}
end
vim.fn.setqflist(qf, "a")
vim.cmd("botright copen")
end,
},
win = {
input = {
keys = {
["<a-q>"] = { "qflist_append", mode = { "n", "i" } },
},
},
},
},
},
},
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jacobrreed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can't as it's currently implemented.
You can however implement a custom action of yours with most of the code shown here.
I believe this should work