Last Updated: July 27, 2016
·
1.357K
· cpatuzzo

CtrlP(ro)

Most people use CtrlP for fuzzy file finding in Vim. But did you know about all of it's cool features?

Recent buffers

Some people use buffergator for listing their recent buffers. Some people use the ls command.

I'd rather use: Ctrl-p Ctrl-f

Start typing a buffer name, or use Ctrl-j and k to navigate the list.

Regular expressions

Did you know you can search by regular expression?

To find files containing numbers: Ctrl-p Ctrl-r [0-9]

Multiple files in splits

This is a really cool feature.

You can mark files for opening with Ctrl-z. When you've marked as many files as you'd like, just hit Ctrl-o to split on them.

Diffs

Suffix whatever you've entered with :diffthis and you'll be able to diff against the current buffer in a split.

This magically works with multiple files too.

For example, you could diff your production and staging deploy scripts with something like:

Ctrl-p dep/p Ctrl-z [[backspace]] s Ctrl-z :diffthis Ctrl-o

This looks confusing, but it basically marks the two files, then opens them with :diffthis.

More

You can do other things too, like opening a file and going to a specific line, or only searching by file names rather than full paths (less fuzzy). I don't use these too often, but you can read about them here.