VIM: Automatically insert words into CtrlP
If you use the excellent CtrlP plugin for VIM here's a quick tip. You can automatically insert the word under your cursor into CtrlP. This is super handy especially for PHP development where class names often map to file names 1:1. To do this we need to create a mapping that will bring up CtrlP, press and then press w:1nmap lw :CtrlPw
If you want to insert a selected line straight into CtrlP you can do that asA well:1vmap lw y:CtrlPc
Pressing lw in normal mode should now open CtrlP, insert and search for the word under your cursor. When in visual mode it should insert and search for the selected text. PrettyA neat!