feat(picker_ui): add opts.on_submit hook for custom selection action#606
Merged
Conversation
Allows callers to override the default :edit action when the user picks an item, enabling integrations like opening the directory in oil.nvim. Refs #605
dmtrKovalenko
approved these changes
Jun 16, 2026
Owner
|
@gustav-fff I remember there was another related issue please find it and link |
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #605
Root cause
Picker UI hardcodes
:edit(orsplit/vsplit/tab) on selection atlua/fff/picker_ui/picker_ui.lua:498. The only extension point —select.select_window(lua/fff/conf.lua:65) — picks the target window but cannot replace the open action itself. Use-cases like "open the directory of the selected file in oil.nvim" have no hook.Fix
Add
opts.on_submittofind_files(opts). When set, it runs in place of the default open action after the picker closes. Receives the item plus a context table (action, abs path, relative path, location, query, mode). Query history tracking still runs. No behavior change whenon_submitis unset.Signature:
fun(item, ctx)wherectx = { action, path, relative_path, location, query, mode }.Steps to reproduce
Pre-fix on
main: there is no way to intercept selection. After the patch:Expected: oil opens at the directory containing the selected file. Actual (pre-fix): the file is
:edit-ed; reporter has no hook to override.How verified
Manual review of
M.selectflow:on_submitruns inside the samevim.scheduleafterM.close(), so picker teardown completes before the callback fires (same ordering as the default:editpath). Whenon_submitis unset the original path is taken verbatim.Did not run a Neovim-level e2e — flagging for maintainer to sanity-check the oil integration interactively.
Automated triage via Gustav. Honk-Honk 🪿