feature: add `resumable` picker option
Did you check the docs?
- [X] I have read all the snacks.nvim docs
Is your feature request related to a problem? Please describe.
I'd like to migrate to snacks explorer. One of the things that is bothering me is that after opening and closing (I'm using auto_close), it overrides the last opened picker and Snacks.picker.resume() then opens the explorer.
Describe the solution you'd like
Add an option like resumable = true | false to picker options, so we can filter out pickers that we don't want to override the last opened picker.
Describe alternatives you've considered
none
Additional context
No response
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Bad bot.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
not stale, ty
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Very bad bot...
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Bad bot!
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Nope
I'd like to keep the same picker.explorer() instance every time I call it, with the cursor staying in the same place even if I open and close it multiple times.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Not, stale, very much still wanted.
+1
This has been addressed in commit c210439!
Your Request
You wanted a resumable option to prevent certain pickers (like explorer with auto_close) from overriding the last opened picker when using Snacks.picker.resume().
The Solution
The new resume implementation uses a different approach that's more flexible:
1. Per-Source State Storage
Instead of one M.last variable, each picker source now maintains its own resume state:
M.state["files"] = { ... }
M.state["explorer"] = { ... }
M.state["lsp_references"] = { ... }
2. Flexible Resume API
You can now control what to resume at runtime:
-- Resume a specific picker (ignores explorer)
Snacks.picker.resume("files")
-- Resume anything except explorer
Snacks.picker.resume({ exclude = {"explorer"} })
-- Resume only from specific pickers
Snacks.picker.resume({ include = {"files", "grep"} })
-- Resume most recent (current default behavior)
Snacks.picker.resume()
Benefits Over a resumable Flag
- ✅ No need to configure pickers upfront
- ✅ Runtime control over what to resume
- ✅ Can resume any previous picker, not just the last one
- ✅ Explorer still saves state (useful if you explicitly want to resume it)
- ✅ More powerful and flexible
Your Use Case
Simply use Snacks.picker.resume({ exclude = {"explorer"} }) or resume specific pickers by name to avoid the explorer override issue.
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]