Daniel Florido
Daniel Florido

Reputation: 79

Silver Searcher: Excluding files in vimrc

Is there a way to exclude files from an ag search by adding an array of files to the vimrc file?

Like with FuzzyFinder, file extensions are ignored by adding this:

let g:fuf_file_exclude = '\v\~$|\.o$|\.exe$|\.bak$|\.swp$|\.class$'

I actually just want to exclude my style.css as most of the time I want to locate a term in the scss working file and not the minified output in style.css.

Upvotes: 1

Views: 1224

Answers (1)

sbeam
sbeam

Reputation: 4892

ag will read in most VCS ignore files by default (see the --skip-vcs-ignores option -- you have to turn it off specifically). This means it will read .gitignore file (or .hgignore, or svn:ignore) in your project and ignore anything in there. Works well for my needs.

If you are having problems with compiled CSS files (or source maps, or the like) you might also want to configure your build scripts or whatever you use (grunt, gulp) to keep the .scss files in a /src directory and the .css files in /public (for instance) - and then add "public/" to .gitignore.

Upvotes: 4

Related Questions