Last Updated: February 25, 2016
· av-ast

How to speed up CtrlP

CtrlP is an amazing vim plugin for fuzzy search but it starts to slow down for a fairly large projects.
In order to speed up your CtrlP you can exclude some folders and files from indexing in this way:

Put these lines into your .vimrc:

" Ignore some folders and files for CtrlP indexing
let g:ctrlp_custom_ignore = {
  \ 'dir':  '\.git$\|\.yardoc\|public$|log\|tmp$',
  \ 'file': '\.so$\|\.dat$|\.DS_Store$'
  \ }

Here is a link to my gist.

4 Responses
Add your response


In fact, you could go even further and use ag to grep files (it is faster than find)

" Use The Silver Searcher
if executable('ag')
  " Use Ag over Grep
  set grepprg=ag\ --nogroup\ --nocolor

  " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
  let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'

Credits: Thoughtbot dotfiles

over 1 year ago ·

akalyaev thanks for your notice! I'll give it a try.

over 1 year ago ·

Note that there are some files you might want to open, like db/structure.sql, which ag ignores.

over 1 year ago ·

Complementing: ctrpl also ignores files specified via wildignore.

over 1 year ago ·