Here are two more scripts. Both are building interactive menus and preview the content of the file/description in a small window while live searching. woman is a man explorer and yayqp is description explorer of installed packages. I’m not the greatest at naming stuff.^^
#!/usr/bin/env bash
yay_preview() {
yay -Qqil "${1}"
}
export -f yay_preview
yay_preview_output() {
yay_preview "${1}" | less
echo "\$ yay -Qqi ${1}"
yay -Qqi "${1}"
}
export -f yay_preview_output
yay -Qq |
grep -E -- "${1}" |
fzf --preview 'yay_preview {}' \
--no-sort \
--reverse \
--border rounded \
--border-label ' [Query Packages] ' \
--bind 'enter:execute(yay_preview_output {})'
#!/usr/bin/env bash
# Lookup section meaning in `man man`.
sections='1,8,6,5,7'
show_manual () {
man -- "${1%% *}" 2> /dev/null
}
export -f show_manual
if selection=$(man -k . --sections="${sections}" \
| sort -t ' ' -k 2,2 -k 1,1 \
| fzf -q "${*}" \
--cycle \
--border=none \
--bind change:first \
--bind tab:down \
--bind shift-tab:up \
--bind esc:cancel+clear-selection \
--tiebreak=begin,chunk,length \
--reverse \
--preview='show_manual {}' \
--preview-window=down:70%:wrap:border-rounded)
then
show_manual "${selection}"
fi