Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

CtrlP plugin for Vim

📅 2014-Sep-02 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

[caption id="attachment_6396" align="aligncenter" width="576"][CtrlP in action](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).

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'

Tried with: Vim 7.4 and Ubuntu 14.04