Trying Out Vim Plugins (Series)

Part 2 - ctrlp.vim

Today’s plugin is ctrlp.vim. I’ve used it for years but wanted to revisit it as part of setting up my new computer. Let’s check it out.


ctrlp.vim is a fuzzy finder plugin. It allows you to search for files, buffers, tags, and the like without having to type the exact name in. I could find the source file for this post, for example, by typing in just tryingpart2 after pressing Ctrl-P to activate the plugin.

Custom Ignore

I did need to make a couple tweaks to the configuration before I could make practical use of the plugin.

By default ctrlp.vim will index most every file within your working directory. That index process can take some time. But in a project with e.g. node_modules, that process can take ages. I don’t want to open images, executables, or other non-text files in Vim, either, so I filter those out. I want to ignore version control system directories like .git, too. The plugin supports filtering all such files:

let g:ctrlp_custom_ignore = {
	\ 'dir':  '\v[\/]\.(git|hg|svn)$',
	\ 'file': '\v\.(exe|so|dll|rpyc|rpyb|png|wav)$',
	\ }

The plugin can be also configured to ignore files based on .gitignore:

let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']

And that’s it! ctrlp.vim does one thing and seems to do it well and that is all I ask of a plugin. I hope you find it useful!

Previous Plugins

Upcoming Plugins