sharkdp / fd

A simple, fast and user-friendly alternative to 'find'
Apache License 2.0
34.25k stars 816 forks source link

When searching only for files, fd does not respect files defined in ignore files #1613

Closed wojcraft closed 2 months ago

wojcraft commented 2 months ago

What version of fd are you using? fd 10.2.0

Hello!

When I use fd --type f -H, it doesn't respect any of ignore file (like .gitignore, .ignore or .config/fd/ignore). My use case is using it for file selection along with fzf. What should I do, in order to make any of these work global without a git repository?

All the best, Wojcraft

tmccombs commented 2 months ago

Can you provide more details of a minimal reproducable state?

My guess would be your ignore patterns aren't actually matching what you think they are.

.ignore and .config/fd/ignore should be respected with that command.

wojcraft commented 2 months ago

Hi!

I found what was a problem, but I decided to give people facing the similar issue a possible solution

I didn't note I'm using Fish shell and I set FZF_DEFAULT_COMMAND by using set -g VARIABLE value

So the truth was, I didn't really set those option in fzf and it means it didn't work as I expected. Just to note, I used .ignore file in the $HOME directory, but it doesn't matter too much in this case.

Solution: Just use export FZF_DEFAULT_COMMAND="commands" instead of set fish function mentioned above.

I'm closing this GitHub issue, if you have anything to say, feel free to reopen the issue - maybe I could help a little.

All the best for all contributors! Thank you for time @tmccombs Wojcraft