Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find-directory behaves identical to find-file #14

Open
brechtm opened this issue Mar 27, 2021 · 2 comments · May be fixed by #15
Open

find-directory behaves identical to find-file #14

brechtm opened this issue Mar 27, 2021 · 2 comments · May be fixed by #15

Comments

@brechtm
Copy link

brechtm commented Mar 27, 2021

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
Copy link
Author

brechtm commented Mar 27, 2021

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
Copy link
Author

brechtm commented Mar 27, 2021

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.

brechtm added a commit to brechtm/xontrib-fzf-widgets that referenced this issue Mar 27, 2021
- set environment variables temporarily (fix laloch#9)
- set a default for find-dirs using 'find' (fix laloch#14)
- set SHELL to bash so that custom commands aren't slowed down by xonsh startup time
@brechtm brechtm linked a pull request Mar 27, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant