0

I've gotten fzf to work on MacOS X Ventura with the Kitty terminal, and it's great!

Alt+T and Alt+C work as expected, but there's one fly in the ointment.

I can't get either of them to ignore all the spurious files in ~/Library ~/Applications or ~/Music

My environment variables look like this:

export FZF_DEFAULT_COMMAND="fd . $HOME"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="fd -t d . $HOME"

The fd docs say it should ignore anything in my ~/.config/git/ignore, and I've tried adding:

Library
Applications
Music
**/Library
**/Applications
**/Music

As well as a bunch of other combinations with no success.

Thanks in advance for any clues!

4
  • Can you point out the part in the manual where it describes file/directory exclusion via the file you mentioned? I didn’t see any details on this on the linked page.
    – nohillside
    Commented Mar 1, 2023 at 22:39
  • 2
    If you're putting stuff in ~/.config/git/ignore, I would expect that to represent absolute path names, not relative ones, right? fd supports gitignore, but it's not meant as a general exclusions mechanism, it's meant for fd to know what to ignore when you're in a repository. Commented Mar 1, 2023 at 23:34
  • @feoh Leaving my previous comment there for the moment, but are we talking about fd or fzf? Or are you piping fd INTO fzf ? Commented Mar 1, 2023 at 23:36
  • @MarcWilson Not sure what you're asking. The fzf utility uses another utility like fd or rg or whatever to actually do the file searching. So in the end analysis we need that utility to ignore the OSX special files.
    – feoh
    Commented Jul 2, 2023 at 23:18

2 Answers 2

3

In the end analysis, the answer turned out to be adding the absolute paths to $HOME/.config/fd/ignore.

I think Marc Wilson was on the right track, but I decided that putting the restrictions into fd's config was the better choice.

2

Another option (if you don't use fd) is to set the --walker-skipdirs option in the FZF_ALT_C_OPTS environment variable, as explained in the fzf docs:

export FZF_ALT_C_OPTS="
  --walker-skip .git,node_modules,target,Library,Applications,Music
  --preview 'tree -C {}'"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .