Skip to content

Commit b8b534e

Browse files
committed
zfsbootmenu: use fzf --raw when available
1 parent ca3a81b commit b8b534e

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

zfsbootmenu/install-helpers.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ create_zbm_conf() {
9999
has_border=1
100100
fi
101101

102+
# Check if fuzzy finder supports --raw flag
103+
# Added in fzf 0.66.0
104+
105+
local has_raw
106+
if echo "abc" | fzf -f "abc" --raw --exit-0 >/dev/null 2>&1; then
107+
has_raw=1
108+
fi
109+
102110
local has_column
103111
if command -v column >/dev/null 2>&1 ; then
104112
has_column=1
@@ -132,6 +140,7 @@ create_zbm_conf() {
132140
export HAS_DISABLED="${has_disabled}"
133141
export HAS_BORDER="${has_border}"
134142
export HAS_COLUMN="${has_column}"
143+
export HAS_RAW="${has_raw}"
135144
export ZBM_BUILDSTYLE="${ZBM_BUILDSTYLE}"
136145
export ZBM_RELEASE_BUILD="${zfsbootmenu_release_build}"
137146
EOF

zfsbootmenu/lib/fzf-defaults.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ if [ ${loglevel:-4} -eq 7 ] ; then
3535
)
3636
fi
3737

38+
if [ -n "${HAS_RAW}" ]; then
39+
fuzzy_default_options+=(
40+
"--raw"
41+
"--bind" '"result:best"'
42+
"--bind" '"up:up-match"'
43+
"--bind" '"down:down-match"'
44+
)
45+
fi
46+
3847
export FUZZYSEL=fzf
3948
export PREVIEW_HEIGHT=2
4049
export FZF_DEFAULT_OPTS="${fuzzy_default_options[*]}"

0 commit comments

Comments
 (0)