Skip to content

Commit 211c08e

Browse files
committed
feat(binds): unified bind transform for fzf >= 0.59
Add lua/fzf-lua/binds.lua (~740 lines) implementing the consolidated bind transform system described in docs/specs/2026-03-27-unified-binds-design.md. WHAT: All complex binds (lua functions, reload, exec_silent, builtin actions, events) are routed through a single --bind=key1,key2,...:transform:CMD entry point using shell.pipe_wrap_fn. Simple fzf-native actions (abort, half-page-down, etc.) stay as direct --bind=key:action. Accept actions use print(key)+accept so fzf can exit. Neovim-only keys (e.g. <C-Enter>) use SIGWINCH bridge terminal keymaps. WHY: Eliminates the need for separate convert_reload_actions and convert_exec_silent_actions pipelines, and removes neovim terminal keymaps for builtin actions (toggle-preview, toggle-help, etc.) when fzf >= 0.59. All key dispatch goes through fzf's own bind system, making binds work consistently regardless of focus. KEY DESIGN DECISIONS: - Gated to fzf >= 0.59 (can_unified check); legacy path unchanged - Accept both old (keymap.fzf/keymap.builtin/actions) and new (binds) formats indefinitely, no deprecation - 5 bind categories: Direct, Accept, Transform, SIGWINCH, Dropped - Events use __evt__<name> prefix since $FZF_KEY is empty for events - For builtin previewer without split, toggle-preview does NOT send fzf actions (fzf's preview pane is zero-width) - { fn, actions.resume } backward compat converted to { fn, reload=true } - Precedence: binds > actions > keymap.fzf > keymap.builtin FILES CHANGED: - lua/fzf-lua/binds.lua (new): normalize_binds(), build_transform_binds(), classify_bind(), _make_handler(), _execute_builtin(), _create_dispatch_handler(), can_unified() - lua/fzf-lua/core.lua: import binds module, gate fzf_wrap to call binds.build_transform_binds when can_unified - lua/fzf-lua/win.lua: unified path in setup_keybinds (SIGWINCH terminal keymaps, toggle-preview SIGWINCH handlers, Esc fix, early return); nil guard in on_SIGWINCH resize handler for window reuse safety
1 parent 690f545 commit 211c08e

3 files changed

Lines changed: 801 additions & 3 deletions

File tree

0 commit comments

Comments
 (0)