Ignoring files/directories with CtrlP

I’ve been working on a project that uses Node.js. Node’s package manager, npm, installs all of the packages that you’re using into a node_modules directory inside of your project. Usually when I’m trying to open a file with CtrlP in VIM, I don’t care about the files in the node_modules directory. Even worse, these files overwhelm CtrlP and make it difficult to actually open the files that I’m looking for.

I was really excited when I saw that CtrlP lets you add the following into your .vimrc to specify files/directories that you want to ignore:

let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$' 

Unfortunately, this won’t work if you’re using Ag (The Silver Searcher) as your search tool.

No worries, Ag has it’s own way of...

Continue reading