## Description
I was using LazyGit feature to filter git logs by the author,
unfortunately it was missing in snacks picker. Here is my solution to
it. Let me know if you have better suggestion :)
---------
Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
## Description
<!-- Describe the big picture of your changes to communicate to the
maintainers
why we should accept this pull request. -->
This PR builds on
7122a03fdf
to provide a way to pass custom `args` to git command invocations.
An alternative (probably cleaner) way of doing this could be to add an
`args` field to `picker.sources.git`:
```yaml
picker = {
---@class snacks.picker.previewers.Config
previewers = {
git = {
args = git_opts(),
},
},
---@class snacks.picker.sources.Config
sources = {
git = {
args = git_opts(),
},
},
```
## Related Issue(s)
<!--
If this PR fixes any issues, please link to the issue here.
- Fixes #<issue_number>
-->
Fixes#1184
## Screenshots
<!-- Add screenshots of the changes if applicable. -->
---------
Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
## Description
Handle [detached
HEAD](https://git-scm.com/docs/git-checkout#_detached_head)
- list: display correct information
- preview: without error notification
- action: checkout the commit that HEAD detached at
<!-- Describe the big picture of your changes to communicate to the
maintainers
why we should accept this pull request. -->
## Related Issue(s)
<!--
If this PR fixes any issues, please link to the issue here.
- Fixes #<issue_number>
-->
- Fixes#672
## Screenshots
<!-- Add screenshots of the changes if applicable. -->
Before:
<img width="1308" alt="image"
src="https://github.com/user-attachments/assets/fad291a3-a730-4a2b-9eb2-4a0edd83d794"
/>
After:
<img width="1038" alt="image"
src="https://github.com/user-attachments/assets/d312579a-e12d-4286-845c-a706d91a6c95"
/>
---------
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. -->