1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2025-01-06 22:16:03 +01:00

zsh: add ffunctions (fuzzy functions list)

This commit is contained in:
bretello 2024-12-09 11:22:22 +01:00
parent 075e06df8f
commit d9d88fb8de
Signed by: brethil
GPG Key ID: 876AAC6290170FE7

View File

@ -385,3 +385,13 @@ function which(){
builtin which $@ | bat --language=zsh
fi
}
# list all functions, highlighted, using fzf (adapted from https://github.com/junegunn/fzf/releases/tag/v0.56.0)
function ffunctions(){
if [[ $(fzf --version | cut -d " " -f 1 | cut -d. -f 2) -ge 56 ]]; then
gap_arg="--gap"
fi
declare -f | perl -0777 -pe 's/^}\n/}\0/gm' |
bat --plain --language bash --color always |
fzf --read0 --ansi --reverse --multi $gap_arg
}