-
|
I have created this custom function to use with the explorer local function choose_picker_action(source)
local Snacks = require("snacks")
local explorer = Snacks.picker.get({ source = source })
if #explorer == 0 then return end
local node = explorer[1]
local cursor = node.list.cursor
local item = node.finder.items[cursor]
if item == nil then return end
if item.type ~= "directory" then
local ok = node:action({ "pick_win", "jump" })
if ok then return end
end
node:action({ "confirm" })
endmapped like this picker = {
enabled = true,
sources = {
explorer = {
auto_close = true,
win = {
list = {
keys = {
["a"] = "explorer_add",
["d"] = "explorer_del",
["r"] = "explorer_rename",
["c"] = "explorer_copy",
["p"] = "explorer_paste",
["u"] = "explorer_update",
["x"] = "explorer_move",
["y"] = "explorer_yank",
["<CR>"] = function()
choose_picker_action("explorer")
end
}
}
}
},
},
}so that when from the explorer i press
and I was wondering if this was possible also for I tried adding |
Beta Was this translation helpful? Give feedback.
Answered by
nautilor
Mar 10, 2026
Replies: 1 comment 3 replies
-
Line 234 in 9912042
---@module 'snacks'
return {
"folke/snacks.nvim",
lazy = false,
---@type snacks.Config
opts = {
picker = {
actions = {
print_item = function(picker, item)
vim.print(item)
end,
},
win = {
input = {
keys = {
["<F1>"] = { "print_item", mode = { "i", "n" } },
},
},
list = {
keys = {
["<F1>"] = "print_item",
},
},
},
sources = {
explorer = {
actions = {
print_item = function(picker, item)
vim.print({ cwd = picker:cwd(), item = item })
end,
},
win = {
input = {
-- keys = { ... }
},
list = {
-- keys = { ... },
},
preview = {
-- keys = { ... },
},
},
},
},
},
},
} |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pick_windoes not work if there's no splits, i manage to solve it by using