laloch / xontrib-fzf-widgets

Set of fzf widgets for xonsh
GNU General Public License v3.0
33 stars 18 forks source link

find-directory behaves identical to find-file #14

Open brechtm opened 3 years ago

brechtm commented 3 years ago

To make find-directory do something different from find-file, one needs to set $fzf_find_dirs_command.

However, setting it to fd -t d (as suggested in the README) is noticably slower. This also goes for $fzf_find_command = "fd". I haven't yet been able to figure out which find command produces similar output to fd -t d, unfortunately.

brechtm commented 3 years ago

I finally got find-directory to work with the following settings:

$fzf_find_command = "bash -c \"set -o pipefail; command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune -o -type f -print -o -type l -print 2> /dev/null | cut -b3-\""
$fzf_find_dirs_command = "bash -c \"set -o pipefail; command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune -o -type d -print -o -type d -print 2> /dev/null | cut -b3-\""

Unfortunately, it's just as slow as when using fd. It turns out just setting the FZF_DEFAULT_COMMAND causes the slowdown.

brechtm commented 3 years ago

There is no such delay when running fzf in bash with FZF_DEFAULT_COMMAND set. I suspect xonsh's startup time is to blame, similar to what is described in this fzf issue.