From d9d88fb8de859489e041b8ef9870fee58eab8d1f Mon Sep 17 00:00:00 2001 From: bretello Date: Mon, 9 Dec 2024 11:22:22 +0100 Subject: [PATCH] zsh: add ffunctions (fuzzy functions list) --- functions/misc.zsh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/functions/misc.zsh b/functions/misc.zsh index f62cbbe..9278c68 100755 --- a/functions/misc.zsh +++ b/functions/misc.zsh @@ -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 +}