Replies: 1 comment 7 replies
-
Variant 1Tip To apply opts = {
picker = {
sources = {
files = { -- NOTE: `files` picker
actions = {
print_selected = function(picker, item)
local multi_selection = picker:selected { fallback = true }
vim.print { item, multi_selection }
end,
},
win = {
-- NOTE: Using the `input` keymap with `mode = { 'i', 'n' }` will cover almost all cases,
-- so you can skip creating `list` and `preview` keymaps
input = {
keys = {
['<CR>'] = { 'print_selected', mode = { 'i', 'n' } },
-- Or
['<CR>'] = { { 'print_selected', 'confirm' }, mode = { 'i', 'n' } },
},
},
-- NOTE: `explorer` picker is focused on the list by default
list = {
keys = {
},
},
preview = {
keys = { Variant 2Note Jump is the default action but some pickers may override it. See sources.lua. opts = {
picker = {
sources = {
files = { -- NOTE: `files` picker
confirm = function(picker, item, action) -- [[Override]]
local multi_selection = picker:selected { fallback = true }
vim.print { item, multi_selection }
Snacks.picker.actions.jump(picker, item, action)
end, |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When I have selected something in the picker how can I set another keymap like
C-w
to do a custom function with the selection? Instead of theconfirm
action when I typeEnter
.Beta Was this translation helpful? Give feedback.
All reactions