:best of Vim

Showcasing the top Vim plugins, tips and tricks.

What is Vim?

Vim is a text editor for programmers, power users & command-line junkies.

What is :best of Vim?

:best of Vim showcases the best plugins, extensions & tips for making the most of Vim.

It was built for NoVIMber 2011.

Learn more...

Follow

Ctrl-P

If Vim made finding files as easy as it makes makes manipulating them, life would be sweet. A few plugins have been written to try to address this (FuzzyFinder and Command-T being the obvious ones). Of them, Ctrl-P currently leads the field (in BestOfVim's opinion).

Ctrl-P is a file-finder on overdrive. Once installed, you hit <Ctrl-P> and type in a few characters from your file/path. Ctrl-P quickly finds anything that matches, and sorts by best-guess. This speeds up simple stuff like typing <Ctrl-P>user to find & choose from all the files in your project with user in the name.

But it goes further. Any text you type is considered a partial match. Want to find any user files in the widget subsystem? You can type <Ctrl-P>widgetuser and it will figure out what you meant. You can even type <Ctrl-P>widusr for the same result.

This becomes particularly handy when you don't quite remember what you're looking for. Know you're looking for an HTML file somewhere under one of the template directories? Type <Ctrl-P>tmplhtm and Ctrl-P will do the legwork for you, presenting a list of best-matches.

That's the core of Ctrl-P, but it has lots of polish to its main feature that make it really nice to work with:

  • It will intelligently try to guess your project's root directory, by looking for hints from your version-control system.
  • It makes good use of syntax highlighting to show why it's suggesting the files it's picked.
  • It lets you select and open multiple matches in one go, in split windows or new tabs.
  • It tracks most recently-used files, so you can hunt by recency as well as name.

Ctrl-P's really worth giving a test-drive. It's easy to get started with, and sits happily alongside NerdTree and BufExplorer in your arsenal of filesystem-hunting.

Download

Comments...

Written by