Vim Plugin Spotlight: CtrlP
When I started using Vim I relied on tree-based file browsers like netrw and NerdTree for navigating a project’s files within the editor. After discovering and trying the CtrlP plugin for Vim I found that jumping directly to a file based on its path and/or filename could be faster than drilling down through a project’s directories one at a time before locating the one containing the file I was looking for.
After it’s invoked (usually by a keyboard shortcut) CtrlP will display a list of files in your current project and will filter that list on the fly based on your text input, matching it against both directory names and file names. Pressing
map <leader>b :CtrlPBuffer<cr></cr>
CtrlP has many configuration options that can affect its performance and behavior, and installing additional plugins can provide different matcher engines that search through a directory more quickly and return more relevant results than the default matcher. Alternate matchers I’ve found include:
- https://github.com/burke/matcher
- https://github.com/JazzCore/ctrlp-cmatcher
- https://github.com/FelikZ/ctrlp-py-matcher
Of these, I’ve had the best luck with FelixZ’s ctrlp-py-matcher. It’s easy to install, works on most systems without requiring additional dependencies, and manages to be both faster and return more relevant results than the built-in CtrlP matcher.
CtrlP is well documented in both its README (available on its GitHub project page) and its Vim documentation (available with :help ctrlp within Vim). The documentation covers the different commands and configuration options provided by CtrlP but simply installing the plugin and hitting
Comments