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>
Uses ripgrep's --replace feature to mark exact match positions with
separators (__snacks__${0}__snacks__), then parses these positions
for precise highlighting.
Benefits:
- Exact match highlighting in list, preview, and file formatter
- Works with any grep pattern (regex, fixed-string, case-insensitive)
- No need for pattern parsing or vim.regex workarounds
- Positions are provided directly by ripgrep, guaranteed accurate
Implementation:
- Added item.positions field to track match character indices
- New highlight.matches() helper for creating match extmarks
- Modified grep source to parse and extract positions from rg output
- Updated list, preview, and format to use positions when available
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
## Description
Allows passing extra Git arguments (like `--git-dir` or `--work-tree`)
to the rename detection logic inside `M.log` in `picker/source/git.lua`.
Previously, these extra arguments from `opts.args` were applied to the
main `git log` command but ignored during rename detection. This caused
errors or incorrect results when working in non-standard repo setups.
This change uses `git_args(...)` to build the rename detection command,
ensuring consistent argument handling throughout `M.log`.
## Description
This uses `vim.treesitter.foldexpr` to get the start of a foldlevel,
because `vim.fn.foldlevel()` will return the same number in adjacent
foldlevels, thus making the open fold markers inconsistent.
This will however introduce a dependency on `vim.treesitter.foldexpr`
and I haven't seen any other computations based on `vim.treesitter`, so
maybe this is not desirable?
Unfortunately, I wasn't able to come up with a better solution, so feel
free to disregard.
PS: I came across #1445 and this PR reverts those changes I realize. But
I fail to find a good way for both to co-exist. I tried checking the
value with `vim.api.nvim_get_option_value("foldexpr", {})`, but this
will only work if `vim.opt.foldexpr` will be set directly into one of
the 2. If it's set to another function that is required like in LazyVim,
I'm not able to distinguish what value `foldexpr` is actually set to.
PS2: I'm guessing the same thing happens when `foldexpr` is set to
`vim.lsp.foldexpr` and the ideal would be some way to distinguish which
one is currently active and then use either
`vim.treesitter.foldexpr(lnum):sub(1, 1) == ">"` or
`vim.lsp.foldexpr(lnum):sub(1, 1) == ">"` respectively.
<!-- Describe the big picture of your changes to communicate to the
maintainers
why we should accept this pull request. -->
## Related Issue(s)
Fixes#1533
<!--
If this PR fixes any issues, please link to the issue here.
- Fixes #<issue_number>
-->
## Screenshots
Before

After

<!-- Add screenshots of the changes if applicable. -->
---------
Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
## Description
Add option for `ignorecase` for `git_grep`
<!-- Describe the big picture of your changes to communicate to the
maintainers
why we should accept this pull request. -->
## Related Issue(s)
Fixes#1627
<!--
If this PR fixes any issues, please link to the issue here.
- Fixes #<issue_number>
-->
## Screenshots
<!-- Add screenshots of the changes if applicable. -->
PR #2296 had the conditionals in the wrong order and with an "or"
instead of an "and". This should finally fix the issue and pass
stylelua.
## Description
The correct condition for correcting the off-by-one is:
```
if
(Snacks.config.styles.snacks_image.relative ~= "editor")
and ((vim.o.showtabline == 2) or (vim.o.showtabline == 1 and vim.fn.tabpagenr("$") > 1))
then
```
This patch gets the conditional in the right order
In PR 1560, @phanen reported an additional case that was not handled by
that fix when the style is set to `relative = "editor"`. This new patch
adds a check to handle that case.
## Description ##
This patch adds a check for `Snacks.config.styles.snacks_image.relative
~= "editor"` to the conditional in render_fallback that handles the
off-by-one error. The previous patch fixed the relative = "cursor" case,
but introduced a regression in the relative = "editor" case.
## Description
This PR builds on top of #743 to add flexible filename formatting in the
picker.
### Changes:
- **Flexible path truncation**: Added support for different truncation
strategies (`left`, `center`, `right`) instead of just a fixed number
- `left`: truncates the beginning of the path (e.g.,
`…/path/to/file.lua`)
- `center`: truncates the middle of the path (default behavior, e.g.,
`~/pro…/file.lua`)
- `right`: truncates the end of the path (e.g., `~/projects/long…`)
- **Dynamic width calculation**: The filename formatter now adapts to
available window width using a resolve function
- **Enhanced truncate utility**: Updated `M.truncate()` to support
left-side truncation
### Implementation:
The filename formatter now uses a `resolve` function that receives
context including the picker, item, current offset, and maximum
available width. This allows the formatter to make intelligent decisions
about how to display the path based on actual available space.
## Related Issue(s)
- Based on #743
- Addresses dynamic path formatting needs
## Technical Details
The implementation introduces:
1. `snacks.picker.format.ctx` - context passed to resolve functions
2. `snacks.picker.format.resolve` - callback type for dynamic formatting
3. `Snacks.picker.highlight.resolve()` - resolves flex text elements in
highlight arrays
---------
Co-authored-by: qw457812 <37494864+qw457812@users.noreply.github.com>
## Description
There is an issue with the quick fix list picker
This happens when list contains some incomplete or invalid items.
The fallback mechanism in the picker have 2 typos that trigger an error
trap
* The item line number field is item.lnum and not item.line
* A check is done on item.text twice in the same if condition, it should
to item.text and item.lnum
## 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. -->
## Description
<!-- Describe the big picture of your changes to communicate to the
maintainers
why we should accept this pull request. -->
Because the search item was lowercased before it was scored, camelCase
would not be triggered to give the intended bonus.
This was the simplest and fastest (code execution wise) fix I could see.
## Related Issue(s)
Fixes: https://github.com/folke/snacks.nvim/issues/1599
## Screenshots
<!-- Add screenshots of the changes if applicable. -->
## Description
Uses absolute path for setting the cursor
<!-- Describe the big picture of your changes to communicate to the
maintainers
why we should accept this pull request. -->
## Related Issue(s)
Fixes#1818
<!--
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: Aaron Weisberg <aaron.weisberg@quizlet.com>
## Description
Parsing the output of git diff here depends on its exact format. The
user environment might be set up with diff.noprefix, in which case the
parsing fails, because the `a/` and `b/` prefixes for the paths is
missing. Passing `-c diff.noprefix=false` to the call overrides this.
<!-- 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>
-->
## Screenshots
<!-- Add screenshots of the changes if applicable. -->
## For people who want to use it NOW!
Use `init` to hack the latest version before this PR merge.
```lua
{
"folke/snacks.nvim",
init = function()
local sources = require("snacks.picker.config.sources")
sources.grep.toggles = {
regex = { value = true },
}
sources.grep.win = {
input = {
keys = {
["<a-r>"] = { "toggle_regex", mode = { "n", "i" }, desc = "Toggle Regex" },
},
},
}
end,
},
```
## Description
This PR adds a new keymap `<a-r>` for toggling the regex in grep picker.
It allows user to get faster when searching some special strings like
`$props()`, or just put a part of line `test to jump faster.
## Related Issue(s)
<!--
If this PR fixes any issues, please link to the issue here.
- Fixes #<issue_number>
-->
## Screenshots
https://github.com/user-attachments/assets/2442b21c-898f-4682-a966-5a82abdd23e8
---------
Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
## Description
Before this fix, identical items are added to history repeatedly. This
PR fixes this by only adding an item to history if it's different from
the last recorded value.
This doesn't completely remove duplicate entries in the history, it only
prevents consecutive identical entries.
## Description
- I was trying to go to the commit page from fugitive commit buffers
- but snacks.nvim doesn't support this (fugitive does) and so I wanted a
way to send the commit IDs to the gitbrowse function after parsing it
myself in my dotfiles
### changes
- added `commit` option to `gitbrowse` config to allow passing commit
hashes directly instead of only auto-detecting from cursor word or file
history
- only falls back to auto-detection when `commit` is not explicitly
provided
## 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. -->
## Description
the documentation for `snacks.notifier.Config` says:
f6c06415a2/lua/snacks/notifier.lua (L120-L122)
But currently all notifications filtered out by either `opts.level` or
`opts.filter` are also omitted from the history, on top of being
suppressed from displaying
Fixes this regression
## Related Issue(s)
* Related to #93, although that was caused by misconfiguration. This one
is an actual bug
* Closes#2208
## Screenshots
n/a
## Description
When opening a terminal with position='current', the terminal buffer
wasn't being set in the current window, causing the original buffer
content to remain visible with terminal styling applied.
This fix adds a call to vim.api.nvim_win_set_buf() to properly set the
terminal buffer when using position='current'. Also updates type
annotations to include the 'current' position option and adds tests to
prevent regression.
Credit to the solution to by @Baricus in issue #2148.
## Related Issue(s)
Fixes#2148
Co-authored-by: Baricus <31926270+Baricus@users.noreply.github.com>
## Description
GitLab highlighting uses a different scheme for range of lines
fb2f3ce787/app/assets/javascripts/repository/mixins/highlight_mixin.js (L114)
## 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. -->
## Description
This PR fixes an issue where normal mode commands were being executed in
terminal mode buffers. The change ensures that the command `norm! zz` is
only executed if the buffer type is not "terminal". This prevents errors
when using Zen mode with terminal buffers.
## Related Issue(s)
- Fixes#1911
## Screenshots
<!-- Add screenshots of the changes if applicable. -->
## Description
Allow specifying a page number for pdfs inside of markdown.
This is done by adding "#page=<page-number>" to the file name. This is
same way it is done in obsidian (as discussed in
https://forum.obsidian.md/t/link-to-the-exact-page-of-and-external-pdf-file/2111)
The parsing of the page info should probably be done way before the
conversion, but this was the best I could with my limited time.
I'm pretty new to lua, and this codebase, so this might not be the best
code, but I hope it at least helps :D
## Related Issue(s)
- Fixes#1805
Fix off-by-one issue in render_fallback when a tabline is shown (e.g.
with plugins like bufferline.nvim).
## Description
When a tabline is used/shown, the positioning in render_fallback is off
by one. This change checks whether a tabline would be shown and uses the
correct math for that case and, otherwise, works as before.
## Related Issue(s)
- Fixes#1557