[caption id="attachment_6396" align="aligncenter" width="576"](https://codeyarns.files.wordpress.com/2014/09/20150320_ctrlp.png) CtrlP in action[/caption]
CtrlP is the one plugin for Vim that literally changes how and where you use the editor! After you start using it, you will stop changing directories, typing out paths and remembering filenames exactly. Using this plugin, you will just open Vim, press a keyboard shortcut, type a few characters of the filename (fuzzy typing, what you type does not even need to be a substring of the filename or file path!). As you type, CtrlP will show and update a list of what it thinks you want and you choose the matching one by pressing Enter. Believe me, it is magic!
So, CtrlP supports opening files from three lists: files around the current directory, your currently open buffers and from the most recently used (MRU) list of files. MRU is basically all the files you had previously opened with Vim. I find MRU to be the killer application of CtrlP and customize it to be the default list to lookup (see how below).
CtrlP can be installed easily from its Github repository here using your favorite Vim plugin manager.
Inside Vim, you can invoke the plugin anytime by pressing
Ctrl+p. By default, CtrlP allows you to open the files around the current directory. They can be filtered down by typing any part of their filename. As each letter is typed, the list of files displayed grows shorter.
If you want to search among MRU or among your open buffers, press
Ctrl+f once or twice to switch to those modes. Press
Esc at any time to dismiss the CtrlP window. You can see which of the three lists is currently being used at the bottom (see screenshot above).
To search in MRU by default, add this line to your
let g:ctrlp_cmd = 'CtrlPMRU'
Most of the time I am opening previously opened files, so I set this in my vimrc file.
let g:ctrlp_cmd = 'CtrlPBuffer'
ksince you need them to type filename characters. Instead you can use
Ctrl+kto achieve the same. Or you can just keep typing more characters that match the filename you are looking for, so that the list shortens and the correct item comes to the bottom.
Tried with: Vim 7.4 and Ubuntu 14.04