Skip to content
Discussion options

You must be logged in to vote

Try this version instead. Your keymap needs to point to an action:

Snacks.picker.pick({
  source = "mysource",
  items = { { text = "test1" }, { text = "test2" } },
  format = "text",
  layout = {
    preset = "select",
    layout = { title = " My picker " },
  },
  win = {
    input = {
      keys = {
        ["<c-r>"] = { "refresh", mode = "i" },
      },
    },
  },
  actions = {
    refresh = function(picker, item)
      vim.notify("Hello, world")
    end,
  },
  confirm = function(picker, item)
    picker:close()
    if item then
      vim.notify("Selected: " .. item.text)
    end
  end,
})

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@pkazmier
Comment options

@Silzinc
Comment options

@pkazmier
Comment options

@raulchen
Comment options

@folke
Comment options

folke Feb 5, 2025
Maintainer

Answer selected by Silzinc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants