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 <C-\>
and then press w
:
1 |
nmap <leader>lw :CtrlP<CR><C-\>w |
If you want to insert a selected line straight into CtrlP you can do that as well:
1 |
vmap <leader>lw y:CtrlP<CR><C-\>c |
As an example, in the above image the cursor is placed oneZINI
. Pressing
<leader>lw
in will open CtrlP, insert and search for
eZINI
.
Pretty neat!