Commit graph

1500 commits

Author SHA1 Message Date
Folke Lemaitre
0e8f43edd7
style(picker): default highlight for SnacksPickerFileType 2025-10-26 20:13:25 +01:00
Folke Lemaitre
2439c493a5
fix(picker): only trim space in the title if it's preceded by a word like character (skips icons) 2025-10-26 20:12:59 +01:00
Folke Lemaitre
a249c86cf1
feat(picker.buffers): add filetype/buftype to search text 2025-10-26 20:12:31 +01:00
Folke Lemaitre
4ad8a41eac
fix(picker.preview): show proper preview message for deleted scratch buffers 2025-10-26 20:12:09 +01:00
Folke Lemaitre
c956b37246
fix(util.job): stop on BufWipeout and BufDelete 2025-10-26 20:11:40 +01:00
Folke Lemaitre
17033e67ef
fix(util): color() should not create hl groups 2025-10-26 20:11:19 +01:00
Folke Lemaitre
3a8ecf5912
perf(notifier): stop trying to fit more notifs in the layout after skipping max 10 2025-10-26 20:10:56 +01:00
Folke Lemaitre
03872973b3
fix(win): scratch buffers were sometimes not deleted 2025-10-26 20:10:17 +01:00
Folke Lemaitre
6a132716af
feat(picker.buffers): added buftype and filetype for scratch buffers 2025-10-26 19:23:47 +01:00
Folke Lemaitre
597ebd4115
fix(picker.git_branches): git log preview. Closes #2360
Some checks are pending
CI / ci (push) Waiting to run
2025-10-26 18:27:57 +01:00
Folke Lemaitre
583a0c1c06
fix: keymap docs 2025-10-26 14:57:03 +01:00
github-actions[bot]
4b3bb54d8b
chore(main): release 2.27.0 (#2351)
🤖 I have created a release *beep* *boop*
---


##
[2.27.0](https://github.com/folke/snacks.nvim/compare/v2.26.0...v2.27.0)
(2025-10-26)


### Features

* **keymap:** added new `enabled` option
([b0f21fa](b0f21fa745))
* **picker.proc:** finder to process json
([5294c4f](5294c4f39e))
* **util.job:** simple wrapper around jobstart to work with terminals
(used in dashboards and pickers)
([de05631](de05631e6a))
* **util.lsp:** added overload for `Snacks.util.lsp.on(cb)`
([f33aa20](f33aa2017a))


### Bug Fixes

* **dashboard:** don't add sleep in nushell. Closes
[#1706](https://github.com/folke/snacks.nvim/issues/1706)
([44f71d2](44f71d2113))
* **explorer:** refresh git status on all tabs when needed. Closes
[#2348](https://github.com/folke/snacks.nvim/issues/2348)
([1472211](1472211f9c))
* **explorer:** windows path fixes
([e1dc6b3](e1dc6b3bdd))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-26 12:21:57 +01:00
Folke Lemaitre
b0f21fa745
feat(keymap): added new enabled option 2025-10-26 12:19:40 +01:00
Folke Lemaitre
5294c4f39e
feat(picker.proc): finder to process json 2025-10-26 11:50:32 +01:00
Folke Lemaitre
1f194746d7
refactor(preview): use util.job 2025-10-26 11:50:06 +01:00
Folke Lemaitre
a4ed279692
style(debug): luals annotations 2025-10-26 11:49:49 +01:00
Folke Lemaitre
d2648e8cef
refactor(dashboard): use util.job to render terminal commands 2025-10-26 11:49:37 +01:00
Folke Lemaitre
44f71d2113
fix(dashboard): don't add sleep in nushell. Closes #1706 2025-10-26 11:49:15 +01:00
Folke Lemaitre
de05631e6a
feat(util.job): simple wrapper around jobstart to work with terminals (used in dashboards and pickers) 2025-10-26 11:48:30 +01:00
Folke Lemaitre
f33aa2017a
feat(util.lsp): added overload for Snacks.util.lsp.on(cb)
Some checks are pending
CI / ci (push) Waiting to run
2025-10-25 19:06:26 +02:00
Folke Lemaitre
1472211f9c
fix(explorer): refresh git status on all tabs when needed. Closes #2348 2025-10-25 18:52:28 +02:00
Folke Lemaitre
e1dc6b3bdd fix(explorer): windows path fixes 2025-10-25 16:22:44 -07:00
github-actions[bot]
fc84ed42a4
chore(main): release 2.26.0 (#2335)
🤖 I have created a release *beep* *boop*
---


##
[2.26.0](https://github.com/folke/snacks.nvim/compare/v2.25.0...v2.26.0)
(2025-10-25)


### Features

* **explorer:** add cross-platform trash support
([ed08ef1](ed08ef1a63))
* **keymap:** add filetype and LSP-aware keymap management
([0bf34af](0bf34afe34))
* **util:** add LSP utility module with dynamic capability handlers
([7a63ba5](7a63ba5d37))
* **win:** add `SnacksWinSeparator` to default `win.wo.winhighlight`
([#2340](https://github.com/folke/snacks.nvim/issues/2340))
([869709d](869709dd65)),
closes [#2336](https://github.com/folke/snacks.nvim/issues/2336)
* **win:** add default *Snacks* prefixed `WinSeparator`
([#2338](https://github.com/folke/snacks.nvim/issues/2338))
([381265b](381265b543)),
closes [#2336](https://github.com/folke/snacks.nvim/issues/2336)


### Bug Fixes

* **dahboard:** do full terminal reset when receiving first output and
displayed cached contents
([c952834](c9528341a6))
* **dashboard:** don't write to closed terminal buffer
([f75eaf1](f75eaf1e18))
* **dashboard:** work-around for jobstart+pty issue where not all output
is processed before exit. Closes
[#1706](https://github.com/folke/snacks.nvim/issues/1706)
([4d776bd](4d776bdd1d))
* **explorer:** macos has `trash` pre-installed, so no need to try
`osascript` and move to first. Closes
[#2349](https://github.com/folke/snacks.nvim/issues/2349)
([d569072](d569072b2e))
* **image:** detach image when reloading image file. Closes
[#2343](https://github.com/folke/snacks.nvim/issues/2343)
([7bf4175](7bf4175588))
* **image:** increase timeout for querying the terminal. Closes
[#2344](https://github.com/folke/snacks.nvim/issues/2344)
([4122143](4122143240))
* **image:** let healthcheck wait till terminal detection is done
([b029511](b029511abb))
* **image:** only attach to a buffer once. Closes
[#2343](https://github.com/folke/snacks.nvim/issues/2343)
([6f72643](6f72643323))
* **image:** work around tmux extended-keys breaking TermResponse.
Closes [#2332](https://github.com/folke/snacks.nvim/issues/2332)
([e93dcfd](e93dcfdf39))
* **layout:** provide parent win width/height when relative to win
([#2346](https://github.com/folke/snacks.nvim/issues/2346))
([602393a](602393aed2))
* **picker:** fix race condition causing "Finder yielded after done"
error. Closes [#2327](https://github.com/folke/snacks.nvim/issues/2327)
([c9ccbe5](c9ccbe5617))
* **picker:** set min file width to 40
([69417ac](69417ac681))
* **win:** use `sbuffer` instead of `split` for split windows
([bbd6d42](bbd6d42a97))


### Performance Improvements

* **picker:** don't use treesitter string parser, since a change in
nightly creates thousands of unlisted buffers in that case
([ad6c0a5](ad6c0a5e54))
* **picker:** re-use existing string parsers per language to prevent
needing to create new parsers
([efa304a](efa304a078))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-25 16:54:50 +02:00
Folke Lemaitre
1c80468c9c
docs(keymap): added docs about Snacks.keymap. 2025-10-25 16:33:20 +02:00
Folke Lemaitre
0bf34afe34
feat(keymap): add filetype and LSP-aware keymap management
Add `Snacks.keymap.set()` and `Snacks.keymap.del()` as enhanced alternatives
to `vim.keymap.set/del` with support for:

- **Filetype-specific keymaps**: Set keymaps that only apply to buffers with
  specific filetypes using the `ft` option
- **LSP-aware keymaps**: Set keymaps based on LSP client capabilities using
  the `lsp` option (leverages Snacks.util.lsp)
- **Automatic application**: Keymaps are applied to existing buffers and
  automatically set up for new buffers via FileType autocmd

Drop-in replacement API with smart defaults (silent by default).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 16:32:11 +02:00
Folke Lemaitre
7a63ba5d37
feat(util): add LSP utility module with dynamic capability handlers
Add `Snacks.util.lsp.on()` to register handlers that fire when LSP clients
attach with specific capabilities. Supports filtering by:
- LSP method/capability
- Client name
- Buffer ID
- Any vim.lsp.get_clients() filter

Features:
- Handles both LspAttach and client/registerCapability events
- Ensures handlers only fire once per buffer
- Lazy-loaded via Snacks.util metatable

This provides a foundation for LSP-aware features like conditional keymaps.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 16:31:13 +02:00
Folke Lemaitre
f75eaf1e18
fix(dashboard): don't write to closed terminal buffer 2025-10-25 13:35:33 +02:00
Folke Lemaitre
d569072b2e
fix(explorer): macos has trash pre-installed, so no need to try osascript and move to first. Closes #2349
Some checks are pending
CI / ci (push) Waiting to run
2025-10-25 11:16:29 +02:00
Whitney Beck
602393aed2
fix(layout): provide parent win width/height when relative to win (#2346)
## Description

When a win is relative = "win" it should size itself relative to that
win's size. Currently this only happens correctly when the picker layout
is created. All subsequent updates, such as a toggle_preview action, can
potentially trigger calls to a function width/height opt with a
max_width and max_height smaller than was previously calculated. This
feeds into a recursive series of updates triggered by the WinResized
event triggering and updating with a yet smaller max_width or
max_height.

Additionally, because win.o.cols and win.o.lines is used,
relative/decimal dimensions would not calculate correctly in splits.
Screenshots are from a picker configured as
```
{
    col = 1,
    height = 0.9,
    width = 0.9,
    position = 'float',
    relative = 'win',
}
```
**before** 
<img width="1348" height="1358" alt="image"
src="https://github.com/user-attachments/assets/847b0565-afd0-4ca1-b44c-eb63e335afca"
/>

**after**
<img width="1354" height="1354" alt="image"
src="https://github.com/user-attachments/assets/064f25ae-ed17-42c8-8b34-f32652fab02d"
/>
2025-10-25 08:22:28 +02:00
Folke Lemaitre
ed08ef1a63
feat(explorer): add cross-platform trash support
- Add `trash` config option to use system trash when deleting files
- Implement trash support for Linux (gio, trash-cli, kioclient)
- Implement trash support for macOS (osascript/Finder)
- Implement trash support for Windows (PowerShell/RecycleBin)
- Add health check to verify trash command availability
- Gracefully fallback to permanent delete when trash unavailable
- Improve error messages with command details

Closes #982

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 07:45:02 +02:00
Folke Lemaitre
4122143240
fix(image): increase timeout for querying the terminal. Closes #2344 2025-10-25 06:52:56 +02:00
Folke Lemaitre
7bf4175588
fix(image): detach image when reloading image file. Closes #2343 2025-10-25 06:43:26 +02:00
Folke Lemaitre
c9528341a6
fix(dahboard): do full terminal reset when receiving first output and displayed cached contents
Some checks are pending
CI / ci (push) Waiting to run
2025-10-24 23:49:19 +02:00
Folke Lemaitre
6f72643323
fix(image): only attach to a buffer once. Closes #2343 2025-10-24 23:30:38 +02:00
Folke Lemaitre
4d776bdd1d
fix(dashboard): work-around for jobstart+pty issue where not all output is processed before exit. Closes #1706 2025-10-24 23:25:28 +02:00
flashios09
869709dd65
feat(win): add SnacksWinSeparator to default win.wo.winhighlight (#2340)
See #2336
2025-10-24 17:01:24 +02:00
Folke Lemaitre
efa304a078
perf(picker): re-use existing string parsers per language to prevent needing to create new parsers 2025-10-24 17:00:36 +02:00
flashios09
381265b543
feat(win): add default *Snacks* prefixed WinSeparator (#2338)
See #2336
2025-10-24 16:41:43 +02:00
Folke Lemaitre
ad6c0a5e54
perf(picker): don't use treesitter string parser, since a change in nightly creates thousands of unlisted buffers in that case 2025-10-24 16:39:28 +02:00
Folke Lemaitre
69417ac681
fix(picker): set min file width to 40 2025-10-24 16:26:52 +02:00
Folke Lemaitre
bbd6d42a97
fix(win): use sbuffer instead of split for split windows 2025-10-24 10:55:41 +02:00
Folke Lemaitre
56bdc78505
refactor(scroll): convert to object-oriented state management
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>
2025-10-24 09:43:19 +02:00
Folke Lemaitre
9b22e97647
refactor(picker.preview): centralize builtin/pager git options 2025-10-24 08:30:22 +02:00
Folke Lemaitre
b029511abb
fix(image): let healthcheck wait till terminal detection is done 2025-10-24 07:38:39 +02:00
Folke Lemaitre
c9ccbe5617
fix(picker): fix race condition causing "Finder yielded after done" error. Closes #2327
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>
2025-10-24 07:25:22 +02:00
Folke Lemaitre
e93dcfdf39
fix(image): work around tmux extended-keys breaking TermResponse. Closes #2332
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>
2025-10-24 06:59:17 +02:00
github-actions[bot]
d1eaa30b1b
chore(main): release 2.25.0 (#2329)
🤖 I have created a release *beep* *boop*
---


##
[2.25.0](https://github.com/folke/snacks.nvim/compare/v2.24.0...v2.25.0)
(2025-10-23)


### Features

* **notifier:** added `gap` option. Closes
[#2331](https://github.com/folke/snacks.nvim/issues/2331)
([b1acbb0](b1acbb0fcc))
* **select:** allow configuring options for specific vim.ui.select kinds
([bca5b05](bca5b05838))
* **snacks:** added `Snacks.version`. auto updated by the release
workflow
([a283beb](a283beb6dc))


### Bug Fixes

* **dashboard:** fix issue with opening file at location due to
splitkeep and restoring laststatus/showtabline
([1a2b34d](1a2b34dffd))
* **scroll:** stop animations when buf/changedtick changes
([a42b376](a42b3761f7))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-23 21:30:03 +02:00
Folke Lemaitre
a42b3761f7
fix(scroll): stop animations when buf/changedtick changes 2025-10-23 21:24:33 +02:00
Folke Lemaitre
b1acbb0fcc
feat(notifier): added gap option. Closes #2331 2025-10-23 20:30:49 +02:00
Folke Lemaitre
1a2b34dffd
fix(dashboard): fix issue with opening file at location due to splitkeep and restoring laststatus/showtabline 2025-10-23 20:13:20 +02:00