Commit graph

2265 commits

Author SHA1 Message Date
Folke Lemaitre
080320bb82
fix(picker.preview): don't record previeww searches in history and prevent scrolling from the top. Closes #2305 2025-10-21 23:29:58 +02:00
Folke Lemaitre
2c56e10b1d
feat(image): added support for base64 encoded images in url. Closes #2304 2025-10-21 22:59:36 +02:00
folke
efd5a79cf4 chore(build): auto-generate docs 2025-10-21 20:41:16 +00:00
Folke Lemaitre
8116e0b380
feat(indent): pass win to filter func. Closes #2307 2025-10-21 22:39:49 +02:00
Folke Lemaitre
1417701af6
perf(grep): move match parsing to resolve and fix an issue with .* results. Closes #2308 2025-10-21 22:32:44 +02:00
folke
80286bfcc3 chore(build): auto-generate docs
Some checks are pending
CI / ci (push) Waiting to run
2025-10-21 15:49:35 +00:00
Folke Lemaitre
c9fa6f7b07
feat(picker): added live support to git_log, which uses -S (pickaxe) to search. Closes #1544 2025-10-21 17:49:13 +02:00
Folke Lemaitre
924a9304e9
fix(picker): show_delay is in ms. Also increase it to allow auto_confirm to work properly 2025-10-21 17:48:10 +02:00
Folke Lemaitre
5782b5cda0
feat(git): allow configuring extra git args and git cmd args for all git sources. See #2178 2025-10-21 17:17:14 +02:00
Pedro Pombeiro
f324f96bea
feat(picker.git): use default previewer args in git_show (#1736)
## 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.
2025-10-21 16:43:37 +02:00
folke
5f52f9d9e2 chore(build): auto-generate docs 2025-10-21 14:40:16 +00:00
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
a5d45d543e
fix(explorer): reset main when entering another window. Closes #1587 2025-10-21 16:30:33 +02:00
folke
d358bf1755 chore(build): auto-generate docs 2025-10-21 14:17:54 +00:00
Folke Lemaitre
cc69a9304b
fix(dashboard): restore showtabline/laststatus when entering another non-float window. Closes #1774 2025-10-21 16:16:33 +02:00
folke
ce8d36564c chore(build): auto-generate docs 2025-10-21 14:10:21 +00:00
Folke Lemaitre
0bf8fe4ece
fix(picker.format): apply hidden file hl group last. Fixes #2127 2025-10-21 16:07:59 +02:00
folke
284ea48e7c chore(build): auto-generate docs 2025-10-21 14:05:52 +00:00
Folke Lemaitre
8c501965be
fix(terminal): stack only terminal splits by default. Closes #2137 2025-10-21 16:04:38 +02:00
Folke Lemaitre
e46a09427c
feat(win): make split window "stacking" configurable 2025-10-21 16:04:38 +02:00
folke
ee0de23301 chore(build): auto-generate docs 2025-10-21 13:48:28 +00:00
Folke Lemaitre
c757d4dc28
fix(layout): allow width/height to be a function. Closes #2184 2025-10-21 15:47:08 +02:00
folke
82e3b545f3 chore(build): auto-generate docs 2025-10-21 13:39:28 +00:00
folke
d5faeafe2d chore(build): auto-generate docs 2025-10-21 13:39:16 +00:00
Folke Lemaitre
67bb3a7ba0
fix(picker): show_delay config value 2025-10-21 15:38:12 +02:00
Folke Lemaitre
64583a0386
fix(picker): added show_delay to config max ms to wait to show if no results found yet. Closes #2206 2025-10-21 15:37:51 +02:00
phanium
5173e96f33
fix(image): ENOENT on preview (#2301)
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>
2025-10-21 14:46:27 +02:00
Folke Lemaitre
d491236941
fix(input): zindex. Closes #2302 2025-10-21 14:45:04 +02:00
Folke Lemaitre
df018edfdb
fix(picker.list): resize when needed. Closes #2290 2025-10-21 14:44:03 +02:00
Folke Lemaitre
ad6cbc8d5d
fix(input): schedule stopinsert. Fixes #1841 2025-10-21 13:38:37 +02:00
Folke Lemaitre
67d690d362
fix(input): zindex 2025-10-21 13:32:59 +02:00
folke
4f1493025f chore(build): auto-generate docs 2025-10-21 11:17:40 +00:00
Folke Lemaitre
756a791131
fix(picker): prevent WinEnter handling during startup
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>
2025-10-21 13:16:14 +02:00
folke
aafa55d839 chore(build): auto-generate docs 2025-10-21 10:51:25 +00:00
Folke Lemaitre
e796aef0fa
fix(picker): correct z-index for preview="main" layout
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>
2025-10-21 12:49:56 +02:00
folke
5558e285f5 chore(build): auto-generate docs 2025-10-21 10:44:37 +00:00
Folke Lemaitre
2b22fe7861
feat(picker): add git_restore action for git_status picker
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>
2025-10-21 12:43:00 +02:00
folke
050052494e chore(build): auto-generate docs 2025-10-21 10:29:11 +00:00
Folke Lemaitre
3b54c8d3d1
feat(picker): add exact match position highlighting for grep results
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>
2025-10-21 12:27:45 +02:00
hungpt-a8e
2aee35d059
feat(picker.git): allow passing extra args to git log command for file renames (#1964)
Some checks are pending
CI / ci (push) Waiting to run
## 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`.
2025-10-21 09:20:27 +02:00
folke
d31f50f0a7 chore(build): auto-generate docs 2025-10-21 07:17:46 +00:00
Iordanis Petkakis
7bcd3baaf8
fix(statuscolumn): show open folds in consecutive levels (#1534)
## 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 

![2025-03-08_18-19](https://github.com/user-attachments/assets/ec911497-3883-4a94-a607-7ce0f7021a8d)

After

![2025-03-08_18-20](https://github.com/user-attachments/assets/ed80f174-759a-41e5-b5af-9366e66a2d4a)


<!-- Add screenshots of the changes if applicable. -->

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-10-21 00:16:15 -07:00
folke
cb0df73188 chore(build): auto-generate docs 2025-10-21 06:39:43 +00:00
folke
507190018e chore(build): auto-generate docs 2025-10-21 06:38:34 +00:00
Iordanis Petkakis
7502e77803
fix(picker.git): add ignorecase for git_grep (#1629)
## 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. -->
2025-10-21 08:38:26 +02:00
Sassan Haradji
9df47bce6a
feat(image): add icns support (#2120)
## Description

Add support for icns using sips

## Screenshots

<img width="708" height="910" alt="image"
src="https://github.com/user-attachments/assets/9ca85b23-e020-4b05-9aeb-6d40666d71b6"
/>

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-10-21 08:37:14 +02:00
folke
3d8fd67d22 chore(build): auto-generate docs 2025-10-21 06:33:38 +00:00
Folke Lemaitre
c494447737
fix(rename): made rename more robust and make sure target directory exists. Closes #2252 2025-10-21 08:32:27 +02:00
folke
c922358581 chore(build): auto-generate docs 2025-10-21 06:20:00 +00:00
Folke Lemaitre
0b0a58ae4a
fix(picker.actions): <c-g> in list view now prints file path instead of cwd. Fallback to cwd 2025-10-21 08:18:34 +02:00