Ctrl+P ignore git

I can’t get my ctrl+p to ignore git directory. In theory, something like this should work:

let g:ctrlp_custom_ignore = '\v[\/]\.(DS_Storegit|hg|svn|optimized|compiled|node_modules)$'

But then I read if you’re using a command defined with g:ctrlp_user_command like I am to use ag then you should use set wildignore a la this stackoverflow post here. That didnt seem to work, however.

Any ideas?

It does work when I get rid of

if executable('ag')
  set grepprg=ag\ --nogroup\ --nocolor
  let g:ctrlp_user_command = 'ag -Q -l --nocolor --hidden -g "" %s'
  let g:ctrlp_use_caching = 0
endif

but then not as fast :frowning:

I suspect that with a custom ctrlp_user_command, the ctrlp_custom_ignore is, well, ignored.

Try setting your ~/.agignore file to ignore .git, and see if that helps.

You can copy my agignore from here: https://github.com/gabebw/dotfiles/blob/master/agignore

Cool, yea thats kinda what I was thinking… will test it out later today. Thanks! And thanks for the link!