Commit graph

34 commits

Author SHA1 Message Date
Anthony Qiu
2cf864aaa1
feat(picker): add author field to git log (#2295)
## Description

Currently in the picker you cant filter git log pickers by author, the
only option to do that right now is to pass it into the opts when you
call it like lua Snacks.picker.git_log({ author="test" }) but most of
the time I would like to filter interactively and also use the field
filtering offered by snacks like file:lua$ and with this new change,
author:test.

## Related Issue(s)

<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots
<img width="760" height="842" alt="Screenshot 2025-10-13 at 11 03 28 PM"
src="https://github.com/user-attachments/assets/e57278aa-0fcd-4513-981d-fe8cfe078c64"
/>
<!-- Add screenshots of the changes if applicable. -->

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-10-21 16:38:24 +02:00
Folke Lemaitre
d05071255c
fix(picker.preview): directory preview should use cwd. Closes #2212. Fixes #2093 2025-10-19 10:58:26 +02:00
nickx00
7a5eb1036a
fix(explorer): mounted directories being detected as non-directories in Tree:expand (#2053)
## Description

In certain filesystems — such as bind mounts, NFS, FUSE, or other
mounted paths — uv.fs_scandir_next() may return a nil type for valid
directories. This causes the snacks.nvim explorer to treat mounted
folders as files, making them unexpandable in the UI.

This patch adds a fallback to resolve the correct type when
fs_scandir_next() returns nil. It uses uv.fs_stat() first, and falls
back to vim.fn.isdirectory() if needed.

This ensures that mounted directories are properly marked as navigable.

Code change summary:

- Inside Tree:expand, we now check t == nil
- If so, we call uv.fs_stat() to get the true type
- If fs_stat fails, we fallback to vim.fn.isdirectory
- Final dir = true logic remains intact

Impact:
- Fixes a long-standing bug in mounted directories under /mnt, FUSE,
etc.
- Only runs extra checks when needed (no performance hit for regular
files)
- No changes elsewhere — clean, isolated patch

## Related Issue(s)
  - Fixes #2036

## Screenshots

before:
<img width="1907" height="946" alt="image"
src="https://github.com/user-attachments/assets/15e1b8a5-c999-49e8-8ab5-1d23c60e4969"
/>

after:
<img width="343" height="902" alt="Screenshot_20250715_222920"
src="https://github.com/user-attachments/assets/c7ca2fa0-e0cc-4e3d-a4bb-5345538408f7"
/>

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-09-25 12:45:01 +02:00
Folke Lemaitre
f0d34336db
fix(picker.preview): always use builtin for git log preview 2025-02-25 21:18:06 +01:00
Folke Lemaitre
bd6a62af12
feat(picker): renamed native -> builtin + fixed diff mode used for undo. Closes #1302 2025-02-19 16:56:40 +01:00
Folke Lemaitre
d6a38acbf5
feat(picker): new native diff mode (disabled by default). Can be used to show delta diffs for undo. Closes #1288 2025-02-18 20:47:11 +01:00
Folke Lemaitre
b65178b470
feat(image): show progress indicator when converting image files 2025-02-17 23:56:55 +01:00
Folke Lemaitre
eced3033ea
feat(debug): graduate proc debug to Snacks.debug.cmd 2025-02-16 22:56:28 +01:00
Folke Lemaitre
41c4391b72
feat(picker): allow overriding default file/dir/dir_open icons. Closes #1199 2025-02-15 15:59:26 +01:00
Folke Lemaitre
e35d6cd4ba
feat(image): refactor + css/html + beter image fitting 2025-02-15 14:28:49 +01:00
Folke Lemaitre
c114a0da1a
fix(picker.git): correct root dir for git log 2025-02-15 12:06:25 +01:00
Folke Lemaitre
9c436cb273
fix(picker.git): properly handle file renames for git log. Closes #1154 2025-02-15 08:06:07 +01:00
Folke Lemaitre
001f3002ca
feat(image): markdown inline image preview. opts.image must be enabled and terminal needs support 2025-02-13 18:03:33 +01:00
Folke Lemaitre
910437f145
feat(picker.preview): allow passing additional args to the git preview command 2025-02-11 20:12:26 +01:00
Folke Lemaitre
c1f93e25bb
fix(picker.preview): preview for uris. Closes #1075 2025-02-11 13:49:38 +01:00
Folke Lemaitre
0d5b106d4e
feat(image): health checks 2025-02-10 12:10:57 +01:00
Folke Lemaitre
2b0aa93efc
feat(picker): image previewer using kitty graphics protocol 2025-02-09 22:35:31 +01:00
Folke Lemaitre
f9aca86bf3
fix(picker.preview): hide line numbers / status column for directory preview. Closes #1029 2025-02-09 09:55:48 +01:00
Folke Lemaitre
c8430fdd8d
fix(win): better handling of alien buffers opening in managed windows. See #886 2025-02-03 10:41:16 +01:00
Folke Lemaitre
ea838e2838
fix(picker.preview): only show binary message when binary and no ft. Closes #729 2025-01-28 16:18:00 +01:00
Folke Lemaitre
bb3db117a4
feat(picker): added git_stash picker. Closes #762 2025-01-28 16:05:30 +01:00
Folke Lemaitre
e87f0ffcd1
fix(picker.git): show diff for staged files. Fixes #747 2025-01-28 09:08:17 +01:00
Folke Lemaitre
5429dff1cd
fix(picker.preview): clear buftype for file previews 2025-01-21 12:24:16 +01:00
Folke Lemaitre
cd5eddb1de
fix(picker): better handling of buffers with custom URIs. Fixes #677 2025-01-21 09:18:33 +01:00
Kyle Whliang
390f687431
fix(picker.git_branches): handle detached HEAD (#671)
## 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>
2025-01-20 20:03:38 +01:00
Folke Lemaitre
774e4ff302
refactor(picker.preview): set_lines 2025-01-19 23:40:36 +01:00
Folke Lemaitre
da5556aa6b
fix(picker.preview): off-by-one for cmd output 2025-01-19 23:40:36 +01:00
Folke Lemaitre
8563dfce68
feat(picker): added git_branches picker. Closes #614 2025-01-19 16:24:35 +01:00
Folke Lemaitre
de01907930
fix(picker.colorscheme): nil check. Fixes #575 2025-01-17 10:03:41 +01:00
Folke Lemaitre
1481a90aff
fix(picker.git): git_file and git_line should only show diffs including the file. Fixes #522 2025-01-16 23:21:49 +01:00
Anton Kastritskii
cc69043689
feat(picker.git): added git_diff picker for diff hunks (#519)
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>
2025-01-16 09:54:31 +01:00
Folke Lemaitre
e36e6af96c
feat(picker.git): git diff/show can now use native or neovim for preview. defaults to neovim. Closes #500. Closes #494. Closes #491. Closes #478 2025-01-15 19:00:33 +01:00
Folke Lemaitre
bbd1a0885b
fix(picker.preview): pattern to detect binary files was incorrect 2025-01-15 17:11:00 +01:00
Folke Lemaitre
559d6c6bf2
feat(snacks): added snacks.picker (#445)
## 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. -->
2025-01-14 22:53:59 +01:00