From 7eaceb60f3d583d47de6d4aee7cadf49f994def1 Mon Sep 17 00:00:00 2001 From: Patrick McFarland Date: Mon, 21 Aug 2023 15:15:58 -0400 Subject: [PATCH] A replacement scriptlet for the one I wrote previously featured here --- Examples-(completion).md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Examples-(completion).md b/Examples-(completion).md index b2312ce..218aec9 100644 --- a/Examples-(completion).md +++ b/Examples-(completion).md @@ -75,4 +75,28 @@ _fzf_complete_ssh_notrigger() { complete -o bashdefault -o default -F _fzf_complete_ssh_notrigger ssh complete -o bashdefault -o default -F _fzf_complete_ssh_notrigger mosh complete -o bashdefault -o default -F _fzf_complete_ssh_notrigger ss -``` \ No newline at end of file +``` + +### [BASH] Use `bfs` instead of `fd` for more ergonomic results + +Uses `bfs` to put shallow-depth paths closer to the top of results, while also leveraging `bfs`' superior performance over `fd`. + +Based on: https://github.com/tavianator/bfs/discussions/119 + +See also: [`bfs` vs `fd` vs `find` benchmark](https://tavianator.com/2023/bfs_3.0.html#so-how-fast-is-it) + + +```bash +FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --ansi" +FZF_CTRL_T_COMMAND="bfs -color -mindepth 1 -exclude \( -name .git \) -printf '%P\n' 2>/dev/null" +FZF_ALT_C_COMMAND="bfs -color -mindepth 1 -exclude \( -name .git \) -type d -printf '%P\n' 2>/dev/null" + +_fzf_compgen_path() { + bfs -H "$1" -color -exclude \( -name .git \) 2>/dev/null +} + +_fzf_compgen_dir() { + bfs -H "$1" -color -exclude \( -name .git \) -type d 2>/dev/null +} +``` +