From 109ecbcac6fdc70e20fe23d0e2ce26306da333fe Mon Sep 17 00:00:00 2001 From: Patrick McFarland Date: Wed, 15 Jun 2022 09:46:29 -0700 Subject: [PATCH] There are too many problems with how this solution works; fzf just really needs a "sort by path depth" option internally instead of trying to fake it this way --- Examples-(completion).md | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/Examples-(completion).md b/Examples-(completion).md index ff7f434..aaabcbc 100644 --- a/Examples-(completion).md +++ b/Examples-(completion).md @@ -76,39 +76,3 @@ 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 ``` - -### Path depth and hidden sorted _fzf_compgen_path/dir (feat. `fd` and `rg`) - -Based on the example in the [README](https://github.com/junegunn/fzf#settings) for `fd` integration, this sorts from least to greatest path depth and then sorts hidden files after regular ones. This puts the most likely files you're going to access further up in the list and gets them into `fzf` faster. - -```bash -_fzf_compgen_path() { - local output - local -i depth=1 - while - output=$(fd -H -L -E ".git" --exact-depth "$depth" . "$1") - - rg -v "^\.|/\." <<<"$output" - rg "^\.|/\." <<<"$output" - - depth+=1 - - [ "$output" ] - do true; done -} - -_fzf_compgen_dir() { - local output - local -i depth=1 - while - output=$(fd -H -L -E ".git" --exact-depth "$depth" -t d . "$1") - - rg -v "^\.|/\." <<<"$output" - rg "^\.|/\." <<<"$output" - - depth+=1 - - [ "$output" ] - do true; done -} -``` \ No newline at end of file