Open hoclun-rigsep opened 1 year ago
Unfortunately, there is no way right now since fzf-obc only read what is in COMPREPLY. Will try to see in future if there is a way to achieve this while keeping it not too complex
Okay. I would like to help but I am not sure I have time to figure out how bash completion works. For anyone interested, my workaround is to patch lib/fzf-obc/core-functions.bash thus:
diff --git a/lib/fzf-obc/core-functions.bash b/lib/fzf-obc/core-functions.bash
index 9bdf3b8..71ccdb0 100644
--- a/lib/fzf-obc/core-functions.bash
+++ b/lib/fzf-obc/core-functions.bash
@@ -127,7 +127,7 @@ __fzf_obc_search() {
local cmd
cmd=""
- cmd="command find ${startdir}"
+ cmd="command bfs ${startdir}"
cmd+=" -mindepth ${mindepth} -maxdepth ${maxdepth}"
cmd+=" ${exclude_string}"
if [[ "${type}" == "paths" ]] || [[ "${type}" == "dirs" ]];then
@@ -165,7 +165,7 @@ __fzf_obc_search() {
cmd+=" 2> /dev/null"
if [[ "${cur_expanded}" != "${cur}" ]];then
- cmd=" sed -z s'#${cur_expanded//\//\\/}#${cur//\//\\/}#' < <(${cmd})"
+ cmd=" sed -z s'#${cur_expanded//\//\\/}#${cur//\//\\/}#;20000q' < <(${cmd})"
fi
if [[ -n "${xspec}" ]];then
bfs provides the same UI as GNU find but performs searches breadth-first instead of depth-first, and then I limit to 20000 results. You can change that number for what makes sense with your hardware and desired tradeoff between speed and incidence of false negatives.
I don't suppose there is some way to make recursive completion async (like vanilla
fzf
)?