fzf version: 0.18.0
As the title says, I would like to know how I can ignore multiple directories in fzf?
For example, I would ignore node modules and the .git folder.
How can I do this?
fzf acts like an interactive filter. Default search program is find, but can be changed via FZF_DEFAULT_COMMAND
It's recommended to use silver searcher or ripgrep, which are faster and respect ~/.gitignore.
For example: after installing above program, following can be added in ~/.bashrc:
#determines search program for fzf
if type ag &> /dev/null; then
export FZF_DEFAULT_COMMAND='ag -p ~/.gitignore -g ""'
fi
#refer rg over ag
if type rg &> /dev/null; then
export FZF_DEFAULT_COMMAND='rg --files --hidden'
fi
then put whatever you want to ignore in ~/.gitignore:
###################
.DS_Store
.hg
.svn
*.vscode
node_modules
###################
# Temporary files
*.kate-swp
*.swp
*.swo
*~
you can search in Issues with keywords: exclude, ignore file/folders. There are multiple threads about this. Here is some info:
https://github.com/junegunn/fzf#respecting-gitignore
https://github.com/junegunn/fzf/issues/128
What if the project/folder doesn't have .gitignore?
For example, when I am in the home directory, how can I ignore some folders?
WITHOUT .gitignore.
What if the project/folder doesn't have .gitignore?
It's not local .gitignore but ~/.gitignore which can be specified via core.excludesFile
.
Git respects it inside any git project and above programs also ignore it's pattern but globally
For example, when I am in the home directory, how can I ignore some folders?
As mentioned before when you want to exclude file/folder, you need to do it in the command which pipe the output to fzf!
Yeah, thanks...
Most helpful comment
fzf acts like an interactive filter. Default search program is
find, but can be changed viaFZF_DEFAULT_COMMANDIt's recommended to use
silver searcheror ripgrep, which are faster and respect~/.gitignore.For example: after installing above program, following can be added in ~/.bashrc:
then put whatever you want to ignore in ~/.gitignore:
you can search in Issues with keywords: exclude, ignore file/folders. There are multiple threads about this. Here is some info:
https://github.com/junegunn/fzf#respecting-gitignore
https://github.com/junegunn/fzf/issues/128