zsh: add fuzzyman command for fuzzy search of man pages (with preview)

fix-ci
brethil 2023-09-11 15:46:01 +02:00
parent 76579a603e
commit d1135262de
1 changed files with 19 additions and 0 deletions

19
functions/man.zsh 100644
View File

@ -0,0 +1,19 @@
function fuzzyman() {
local preview_cmd
preview_cmd='command man {+1} 2>/dev/null | bat --style=plain --language=man --color=always'
apropos_args=$@
if [[ -z $apropos_args ]]; then
apropos_args="."
fi
man $(command man -k "${apropos_args}" \
| fzf \
--preview="${preview_cmd}" \
--preview-window=right,60% \
| awk '{print $1}'
)
}
compdef _man fuzzyman=man