diff --git a/Examples-(completion).md b/Examples-(completion).md index dbd0545..b2312ce 100644 --- a/Examples-(completion).md +++ b/Examples-(completion).md @@ -75,19 +75,4 @@ _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 -``` - -### [BASH] List files/dirs by smallest filesystem depth and by length - -A common user will typically attempt to complete a filename that isn't deep into their filesystem tree, nor of a long filename. Replacing the example given in the README with... - -```bash - _fzf_compgen_path() { - fd --hidden --follow --exclude ".git" . "$1" | awk '{ printf "%s\t%s\t%s\n", gsub("/", "/"), length, $0 }' | LC_ALL=C sort -n -t $'\t' -k1,2 | cut -f3- - } - - _fzf_compgen_dir() { - fd --type d --hidden --follow --exclude ".git" . "$1" | awk '{ printf "%s\t%s\t%s\n", gsub("/", "/"), length, $0 }' | LC_ALL=C sort -n -t $'\t' -k1,2 | cut -f3- - } -``` -... will bias fzf into giving more relevant results higher in the list with no performance implication. This has been tested on a moderately slow system (an 11 year old budget system with a SATA SSD), and with a testcase of 200k files it started displaying results in 0.7s. \ No newline at end of file +``` \ No newline at end of file