• Home

  • Custom Ecommerce
  • Application Development
  • Database Consulting
  • Cloud Hosting
  • Systems Integration
  • Legacy Business Systems
  • Security & Compliance
  • GIS

  • Expertise

  • About Us
  • Our Team
  • Clients
  • Blog
  • Careers

  • VisionPort

  • Contact
  • Our Blog

    Ongoing observations by End Point Dev people

    Vim Plugin Spotlight: CtrlP

    Patrick Lewis

    By Patrick Lewis
    February 6, 2015

    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 with CtrlP open toggles through two other modes: most recently used files, and current buffers. This is useful when you want to narrow down the list of potential matches to only files you have worked with recently or currently have open in other buffers. I use CtrlP’s buffer mode to jump between open files so often that I added a custom mapping to invoke it in my .vimrc file:

    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:

    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 on your keyboard is enough to get you started with a faster way to navigate between files in any codebase.

    extensions vim