## Description
Here are some small and hopefully uncontroversial tweaks to package
extraction from LaTeX preambles:
* Don't consider anything in comments
* Make sure that the extracted names are actually the arguments of
`\usepackage` and not some other macro on the same line
* Stop looking for packages at `\begin{document}`, where the preamble
ends and the body of the document begins (you can't load packages after
this, so any `\usepackage` beyond this point is content, not code. Also
saves a huge amount of work in large documents.)
Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
## Description
The scratch module uses `vim.ui.select` which misses the nice things
about the picker.
This implementation adds scratch picker with ability to create, grep and
delete scratch buffers.
Couldn't figure out how to prettify the scratch buffer's name so any
help would be appreciated.
## 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. -->
---------
Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
## Description
Update the winid (in the `win` variable) after `tab drop`.
## Related Issue(s)
Without this patch, when the user set `confirm` to `{ action =
"confirm", cmd = "tabdrop" }` and jump to a location in a different tab,
since the `win` is still pointing to the original window (tab), there'd
be a `Cursor position outside buffer` error.
Refactored picker resume functionality to support multiple picker states instead of just the last one. Each picker source now maintains its own resume state, allowing users to resume any previously opened picker.
Key improvements:
- Multi-state storage: Each picker source tracks its own state independently
- Flexible API: `Snacks.picker.resume({ source = "files" })` or with include/exclude options
- LSP caching: Cache LSP results for instant resume of LSP pickers
- Better UX: Can resume specific pickers by source name
Moved resume logic to dedicated `picker/resume.lua` module for better separation of concerns.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
## Description
This is in place of the rejected PR #2178. Please consider the following
reasons for merging.
This PR adds the possibility to specify pathspec patterns to the `git
grep .... -- <patchspec>` command. This is necessary for ignoring large
git-tracked files (that cannot be added to `.gitignore`) from the git
grep search. git-grepping in some large files with very long lines can
freeze Neovim and make `Snacks.picker.git_grep` completely unusable.
Without this change the picker cannot be configured to use some
pathspecs by default. They can be added dynamically in live mode but
re-typing the same pathspecs every time one needs to use
`Snacks.picker.git_grep` would be silly.
In reply to the [question if cmd_args can be used for
this](https://github.com/folke/snacks.nvim/pull/2178#discussion_r2448762906):
No. The "pathspecs" need to be specified *last* (optionally after `--`).
When configuring Snacks.picker like this:
```lua
sources = {
git_grep = {
cmd_args = { ':!*.min.js', ':!*.min.css', ':!uv.lock' },
},
}
```
then the `cmd_args` are inserted in front of the search pattern and `git
grep` doesn't find anything. The following config can't be used either
because that will cause the [search
pattern](c9fa6f7b07/lua/snacks/picker/source/git.lua (L76))
to be treated as one of the pathspecs.
```lua
git_grep = {
cmd_args = { '--', ':!*.min.js', ':!*.min.css', ':!uv.lock' },
},
```
## Description
<!-- Describe the big picture of your changes to communicate to the
maintainers
why we should accept this pull request. -->
Currently, I'm able to perform a search on a YADM repo by passing the
args `{ "--git-dir", "/Users/pedro/.local/share/yadm/repo.git",
"--work-tree", "/Users/pedro" }` to `picker.previewers.git.args`.
Unfortunately, the `git_show` previewer is currently not using this
configuration, so constantly fails to show the preview with an error
message. This MR fixes the problem by leveraging the existing `git`
local function.
## 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. -->
<img width="1582" alt="image"
src="https://github.com/user-attachments/assets/6f7c3960-cfc0-4c0c-a264-105a721cd9a8"
/>
Previewer working inside a YADM repo.
## 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>
After cb6bf052, occationally I get this error when attach snacks.image
in fzf-lua previewer
vim.schedule callback: runtime/lua/vim/fs.lua:737:
ENOENT: no such file or directory:
/home/phan/.cache/nvim/snacks/image/56bd7d4f-img.shields.io-badge-Made-with-Lua-blueviolet.svg.data
stack traceback:
[C]: in function 'error'
runtime/lua/vim/fs.lua:737: in function 'rm'
snacks.nvim/lua/snacks/image/convert.lua:66: in function 'on_error'
snacks.nvim/lua/snacks/image/convert.lua:340: in function 'on_step'
snacks.nvim/lua/snacks/image/convert.lua:434: in function
<snacks.nvim/lua/snacks/image/convert.lua:433>
When opening Neovim with a directory argument (e.g., `nvim .`), the
explorer's preview window was not being shown automatically. This was
because the WinEnter autocmd in the picker was triggering during the
startup sequence before VimEnter, interfering with the initialization.
The fix adds a check for `vim.v.vim_did_enter == 0` to skip the window
management logic during startup, allowing the explorer to properly
initialize with its preview window enabled.
Fixes#2257 (second issue)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
When using `preview="main"`, the preview window floats over the main
editor window. Set its z-index to 40 (lower than the default 50) to
ensure input and help windows remain on top and visible.
Fixes#2257 (first issue)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Adds a git_restore action that discards changes to files in the
git_status picker. Includes confirmation prompt before discarding
changes to prevent accidental data loss.
Usage:
- `<C-r>` in git_status picker to restore selected file(s)
- Works with multi-select (select multiple files and restore all)
- Shows different confirmation messages for single vs multiple files
Implementation:
- Added git_restore() action in actions.lua
- Bound to <C-r> in git_status picker
- Supports both single and multi-select
- Uses Snacks.picker.select for confirmation
- Refreshes picker and returns to insert mode after restore
Closes#2298🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>