Skip to content

Feat: add --fzf-command option to override FZF_DEFAULT_COMMAND#3599

Open
alberti42 wants to merge 1 commit intosxyazi:mainfrom
alberti42:main
Open

Feat: add --fzf-command option to override FZF_DEFAULT_COMMAND#3599
alberti42 wants to merge 1 commit intosxyazi:mainfrom
alberti42:main

Conversation

@alberti42
Copy link

@alberti42 alberti42 commented Jan 22, 2026

Rationale of this PR

This change adds an optional --fzf-command argument to the fzf plugin. When provided as a string, the plugin sets FZF_DEFAULT_COMMAND for the spawned fzf process. This enables users to control the candidate list (e.g., fd -d=1) without fragile chain of piped commands, or custom argument parsing.

I also published a standalone plugin at fzf-plus.yazi so users can try it immediately while this PR is under review.

This PR solves

  • Keeps the plugin minimal and aligned with fzf’s own configuration model based on FZF_DEFAULT_COMMAND.
  • Works cleanly with Yazi’s argument parsing (no POSIX-style token splitting).
  • Avoids brittle fallbacks and complex parsing.

Usage example

[[mgr.prepend_keymap]]
on   = "z"
run  = "plugin fzf -- --fzf-command='fd -t=d -d=1'"
desc = "Jump via fzf (limited depth, only directories)"

Notes

  • Only string values are accepted; if --fzf-command is present but not a string, the plugin shows an error.
  • Behavior is unchanged when the option is absent.
  • When a selection exists, fzf still receives the selection via stdin (default command is ignored, as expected).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant