发布

  • feat(ui): expose select.pre_select_hook to override window retargeting (#578)

    frostbyte_neo 发布于 2026-06-12 02:57:19 +00:00

    • feat(ui): expose select.pre_select_hook for opening selected files

    Add a config-level escape hatch so users can override or disable the
    default 'retarget away from non-file buffer' behavior on . The
    default hook reproduces the prior logic (skip when current window has
    a special buftype, is non-modifiable, or has 'winfixbuf'). A no-op
    override restores telescope-style 'open in invoking window'.

    Refs #577. Picks up the design from #288.

    • refactor(ui): rename select.pre_select_hook to select_window, return winid

    Per maintainer feedback: nil return = open in invoking window, integer
    return = winid to switch to. Cleaner semantics than mutating current
    window via vim.api.nvim_set_current_win inside the hook.

    • fix(ui): capture select config before close, drop config shadow

    M.close() resets state.config to nil, so the deferred select_window hook
    crashed with "attempt to index local 'config' (a nil value)" — broke
    picker_dir_resolution_spec.lua. Capture config alongside other state
    before close. Also rename inner config = conf.get() to cfg to clear
    the luacheck shadowing warning that was failing CI lint.

    Apply README review suggestions from #578.


    Co-authored-by: gustav-fff 286169375+gustav-fff@users.noreply.github.com

    下载附件