hk_bwg
Last Updated: February 25, 2016
·
8.495K
· 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

8808

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

" Use The Silver Searcher https://github.com/ggreer/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 ""'
endif

Credits: Thoughtbot dotfiles

over 1 year ago ·
8810

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

over 1 year ago ·
9923

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

over 1 year ago ·
15829

Complementing: ctrpl also ignores files specified via wildignore.

over 1 year ago ·