Snacks picker allows setting an icon for selected list entries.
With this PR, we can also select one for unselected entries.
I think it looks great.

(Replica of #583 which I closed by mistake, sorry about that.)
---------
Co-authored-by: biggybi <biggybi@pm.me>
Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
Hi and thank you for the useful plugin!
## Description
I have been exploring the new picker api and got this git diff picker
working which I think can be a nice addition to the existing set of
picker. The key difference from the existing git_status picker is that
it separates each hunk into its own item similar to `git add --patch`
and when you select an item it takes you to the first hunk's line
instead of top of the buffer. Before I put more effort into it I would
like to see if this is a welcome change first.
This implementation can be further extended by allowing to support
additional arguments such as `--staged`, `--ignore-all-space` or both.
A few points on current implementations. I could not get the per line
parsing to work using the
`require("snacks.picker.source.proc").proc(...)` and fell back to
manually parsing the output after the command finished executing. There
are likely many ways to improve it. I have been using it with telescope
for about a year and so far it worked great. I think more people can
benefit from this picker.
## Related Issue(s)
none
## Screenshots
Demo
https://github.com/user-attachments/assets/6cdfa48e-bc29-4194-8430-092fbc5f3dcd
---------
Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
## Description
More info coming tomorrow.
In short:
- very fast. pretty much realtime filtering/sorting in huge repos (like
1.7 million files)
- extensible
- easy to customize the layout (and lots of presets) with
`snacks.layout`
- simple to create custom pickers
- `vim.ui.select`
- lots of builtin pickers
- uses treesitter highlighting wherever it makes sense
- fast lua fuzzy matcher which supports the [fzf
syntax](https://junegunn.github.io/fzf/search-syntax/) and additionally
supports field filters, like `file:lua$ 'function`
There's no snacks picker command, just use lua.
```lua
-- all pickers
Snacks.picker()
-- run files picker
Snacks.picker.files(opts)
Snacks.picker.pick("files", opts)
Snacks.picker.pick({source = "files", ...})
```
<!-- Describe the big picture of your changes to communicate to the
maintainers
why we should accept this pull request. -->
## Todo
- [x] issue with preview loc not always correct when scrolling fast in
list (probably due to `snacks.scroll`)
- [x] `grep` (`live_grep`) is sometimes too fast in large repos and can
impact ui rendering. Not very noticeable, but something I want to look
at.
- [x] docs
- [x] treesitter highlights are broken. Messed something up somewhere
## Related Issue(s)
<!--
If this PR fixes any issues, please link to the issue here.
- Fixes #<issue_number>
-->
## Screenshots
<!-- Add screenshots of the changes if applicable. -->