camspiers / snap

A fast finder system for neovim.
The Unlicense
490 stars 17 forks source link

Exclude/Ignore a folder from search #3

Closed singalhimanshu closed 3 years ago

singalhimanshu commented 3 years ago

So I have a vendor folder in my project and I want to exclude that from search, is there any way to do that? I read through the docs but I couldn't find if it possible or not.

For reference, telescope has file_ignore_patterns for doing this.

ahmedelgabri commented 3 years ago

I think it's better to let the tool you are using do this, fd, rg, etc… for example both respect a .ignore file (which you can then ignore globally from git if you want) or you can add to .git/exclude per repo.

echo ".ignore" >> .git/exclude
camspiers commented 3 years ago

As @ahmedelgabri mentions if it is in your gitignore it will automatically be ignored by ripgrep, however at least for the ripgrep.file producer, you can pass ripgrep custom arguments. I will add this to ripgrep.vimgrep fairly soon too.

So for files the following will create a producer with the custom iglob flag passed to ripgrep.

snap.get'producer.ripgrep.file'.args {"--iglob", "!vendor/*"}

I need to add this to the docs.