Skip to content

Commit f22dffd

Browse files
committed
void-docs: detect sk as usable fuzzy finder.
skim is simpler than fzf, but for this case it's nearly as functional. Also: - update man page. - add quotes around some variables
1 parent 8b10ad6 commit f22dffd

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

res/void-docs.1.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ without a search term, it will show the documentation's home
1717
page. Multiple search terms can be used to filter results. If the user
1818
has the
1919
.Xr fzf 1
20-
utility installed in their system, it will be used to browse the
20+
or
21+
.Xr sk 1
22+
utilities installed in their system, it will be used to browse the
2123
results. Otherwise,
2224
.Nm
23-
will display the first search result. If the
25+
will immediately display the first search result. If the
2426
.Fl s
2527
flag is used,
2628
.Nm

res/void-docs.in

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,21 @@ search_page() {
149149
return 0
150150
fi
151151

152+
_pager=
152153
if command -v fzf >/dev/null; then
153-
file="$(echo "$file" | fzf -1)"
154+
_pager=fzf
155+
elif command -v sk >/dev/null; then
156+
_pager=sk
157+
fi
158+
159+
if [ "$_pager" ]; then
160+
file="$(echo "$file" | $_pager -1)"
154161
[ -z "$file" ] && exit 1
155162
else
156163
file="$(echo "$file" | head -1)"
157164
fi
158165
file="${file%.md}"
159-
echo $file
166+
echo "$file"
160167
}
161168

162169
page=about/index

0 commit comments

Comments
 (0)