From 00642c80587f3e9018d4f537b8e2a0e06207a4b9 Mon Sep 17 00:00:00 2001 From: Bojin Li Date: Thu, 26 Mar 2026 14:18:21 +1100 Subject: [PATCH] fix: support configurable fzf options --- README.md | 6 ++++++ functions/_fifc.fish | 6 +++--- functions/_fifc_action.fish | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f445512..1170707 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,12 @@ By default fifc override `tab`, but you can assign another keybinding: set -U fifc_keybinding \cx ``` +To append custom fzf options globally, for example to disable the `--exact` flag and increase the fuzziness: + +```fish +set -U fifc_custom_fzf_opts +e +``` + fifc can use modern tools if available: | Prefer | Fallback to | Used for | Custom options | diff --git a/functions/_fifc.fish b/functions/_fifc.fish index 18ddac1..42e31a6 100644 --- a/functions/_fifc.fish +++ b/functions/_fifc.fish @@ -3,7 +3,7 @@ function _fifc set -l result set -Ux _fifc_extract_regex set -gx _fifc_complist_path (string join '' (mktemp) "_fifc") - set -gx _fifc_custom_fzf_opts + set -gx fifc_effective_fzf_opts $fifc_custom_fzf_opts set -gx fifc_extracted set -gx fifc_commandline set -gx fifc_token (commandline --current-token) @@ -42,7 +42,7 @@ function _fifc --preview '_fifc_action preview {} {q}' \ --bind='$fifc_open_keybinding:execute(_fifc_action open {} {q} &> /dev/tty)' \ --query '$fifc_safe_query' \ - $_fifc_custom_fzf_opts" + $fifc_effective_fzf_opts" set -l cmd (string join -- " | " $source_cmd $fzf_cmd) # We use eval hack because wrapping source command @@ -82,8 +82,8 @@ function _fifc rm $_fifc_complist_path # Clean state set -e _fifc_extract_regex - set -e _fifc_custom_fzf_opts set -e _fifc_complist_path + set -e fifc_effective_fzf_opts set -e fifc_token set -e fifc_group set -e fifc_extracted diff --git a/functions/_fifc_action.fish b/functions/_fifc_action.fish index 282736b..a87d0b8 100644 --- a/functions/_fifc_action.fish +++ b/functions/_fifc_action.fish @@ -53,7 +53,7 @@ function _fifc_action eval $$comp[$i][4] break else if test "$action" = source; and test -n "$$comp[$i][5]" - set _fifc_custom_fzf_opts "$$comp[$i][6]" + set fifc_effective_fzf_opts $fifc_custom_fzf_opts $$comp[$i][6] if functions "$$comp[$i][5]" 1>/dev/null eval $$comp[$i][5] else