How to run on_select
in files picker?
#2106
Answered
by
drowning-cat
itsonlyjames
asked this question in
Q&A
-
The below works for {
"<leader>P",
function()
Snacks.picker.projects({
on_select = function(path)
vim.cmd("cd " .. path)
vim.notify("Changed directory to " .. path)
end,
})
end,
desc = "Projects",
} I'd like to do the same for my dashboard config item, where {
icon = " ",
key = "c",
desc = "Config",
action = function()
Snacks.picker.files({
cwd = vim.fn.stdpath("config"),
on_select = function(path)
vim.cmd("cd " .. path)
vim.notify("Changed directory to " .. path)
end,
})
end,
} Thank you for your help! |
Beta Was this translation helpful? Give feedback.
Answered by
drowning-cat
Aug 3, 2025
Replies: 1 comment 5 replies
-
Warning There is no files = {
confirm = function(picker, item) --[[Same as `actions.confirm`]]
vim.fn.chdir(picker:dir())
-- For most pickers, the default `confirm` action is `jump`
picker:action 'jump'
end,
} |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
itsonlyjames
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Warning
There is no
on_select
callback.