Converted scroll state management from procedural to OO approach:
- State is now a proper class with methods (get, stop, wo, valid, update, reset)
- Window options now managed per-state (_wo field) instead of global wo_backup table
- Centralized cleanup in State:stop() method
- Consolidated validation in State:valid() method
- Added is_enabled() helper for enable checks
- Simplified code throughout by using state methods
Benefits:
- Clearer state lifecycle management
- Better encapsulation and ownership
- Less code duplication
- More maintainable
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
The old code had a race condition where:
1. R:request() scheduled LSP request setup but immediately suspended
2. R:wait() checked #self.requests (still 0) and returned immediately
3. Finder completed and set running = false
4. Then scheduled function ran and LSP responses came back
5. Callbacks tried to yield items but finder was already done → error
The fix uses a pending counter to track when the scheduled setup function
is running, ensuring we wait for both the setup to complete AND all LSP
responses before the finder completes.
Also improved error handling by checking the err parameter in callbacks.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
When tmux has extended-keys enabled, Neovim's TermResponse autocmd doesn't fire,
causing terminal response sequences to leak as literal text into buffers.
Workaround: Detect this configuration and query tmux directly for the terminal
name using `tmux display-message -p "#{client_termname}"` instead of sending
escape sequences.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
## 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.