[mini.pick] open marked files in buffers instead of quickfix #2246
-
Contributing guidelines
Module(s)mini.pick QuestionI want to make mini.pick open all marked files when I execute choose actions ( My relevant config section: mini_pick.setup({
-- TODO: open multiple
mappings = {
-- choose = "<cr>",
-- choose_marked = "<a-cr>",
choose_in_split = "<a-j>",
choose_in_vsplit = "<a-l>",
choose_in_tabpage = "<a-t>",
refine = "<a-space>",
refine_marked = "<c-space>",
-- TODO: fix focus
choose_left = {
char = "<a-h>",
func = function()
vim.cmd("leftabove vsplit " .. mini_pick.get_picker_matches().current)
return true
end,
},
-- TODO: fix focus
choose_up = {
char = "<a-k>",
func = function()
vim.cmd("leftabove split " .. mini_pick.get_picker_matches().current)
vim.cmd("wincmd k")
return true
end,
},
mark_down = {
char = "<c-t>",
func = input_actions("mark", "move_down"),
},
mark_up = {
char = "<c-a-t>",
func = input_actions("mark", "move_up"),
},
},
source = {
choose_marked = mini_pick.default_choose_marked(mini_pick.get_picker_matches() or {}, { list_type = "location" }),
},
window = {
-- center
config = function()
local height = math.floor(0.75 * vim.o.lines)
local width = math.floor(0.75 * vim.o.columns)
return {
anchor = 'NW',
height = height,
width = width,
row = math.floor(0.5 * (vim.o.lines - height)),
col = math.floor(0.5 * (vim.o.columns - width)),
}
end,
},
}) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The way to go is indeed to set require('mini.pick').setup({
source = {
choose_marked = function(items)
for _, item in ipairs(items) do
MiniPick.default_choose(item)
end
end,
},
})Now, for example, in |
Beta Was this translation helpful? Give feedback.
-
|
I would also suggest not giving up on quickfix = {
char = "<C-q>",
func = function()
local all_items = MiniPick.get_picker_items()
local marked = MiniPick.get_picker_matches().marked
local choose = vim.tbl_isempty(marked) and all_items or marked
MiniPick.default_choose_marked(choose, { list_type = "quickfix" })
end,
}, |
Beta Was this translation helpful? Give feedback.
default_choose_markedis indeed designed to populate quickfix list if there is at least one recognizable buffer/file item.The way to go is indeed to set
config.source.choose_markedto act like choosing every input item. Something like this seems to work: