Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit 2e970fb

Browse files
synicstevearc
andauthored
feat(select): add snacks_picker backend (#188)
* feat(select): add snacks_picker backend Adds the [snacks picker](https://github.com/folke/snacks.nvim/blob/main/docs/picker.md) backend option. Like telescope and fzf-lua, it already provides it's own override for `vim.ui.select`, BUT since plugins like avante rely on using dressing.nvim for picking files and such, having a backend that can fuzzy find is more convenient than the builtin. * Fix screenshot * fix: bump up the priority of the snacks picker --------- Co-authored-by: Steven Arcangeli <506791+stevearc@users.noreply.github.com>
1 parent 5bba15b commit 2e970fb

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ Neovim 0.8.0+ (for earlier versions, use the [nvim-0.7](https://github.com/steve
4242

4343
![Screenshot from 2021-12-02 19-47-56](https://user-images.githubusercontent.com/506791/144542071-1aa66f81-b07c-492e-9884-fdafed1006df.png)
4444

45+
`vim.select` (snacks_picker)
46+
47+
![Screenshot from 2025-01-29 03-08-00](https://github.com/user-attachments/assets/4bc72539-9c81-4428-8778-f7904a16898c)
48+
4549
`vim.select` (built-in)
4650

4751
![Screenshot from 2021-12-04 17-14-32](https://user-images.githubusercontent.com/506791/144729527-ede0d7ba-a6e6-41e0-be5a-1a5f16d35b05.png)
@@ -196,7 +200,7 @@ require("dressing").setup({
196200
enabled = true,
197201

198202
-- Priority list of preferred vim.select implementations
199-
backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" },
203+
backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui", "snacks_picker" },
200204

201205
-- Trim trailing `:` from prompt
202206
trim_prompt = true,

lua/dressing/config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ local default_config = {
6767
enabled = true,
6868

6969
-- Priority list of preferred vim.select implementations
70-
backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" },
70+
backend = { "snacks_picker", "telescope", "fzf_lua", "fzf", "builtin", "nui" },
7171

7272
-- Trim trailing `:` from prompt
7373
trim_prompt = true,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
local M = {}
2+
3+
M.is_supported = function()
4+
return pcall(require, "snacks.picker")
5+
end
6+
7+
M.select = function(_, items, opts, on_choice)
8+
return require("snacks.picker.select").select(items, opts, on_choice)
9+
end
10+
11+
return M

0 commit comments

Comments
 (0)