Are you using MacVim and using CtrlP plugin?

Have you ever found that pressing ctrl+p is not easy on mac?

For me, it is faster when pressing cmd+p instead of pressing ctrl+p.

That’s why i think i have disable or remap the key. In the official repository of CtrlP has been explained very well to changed this keymap.

But, if you are using MacVim replacing the key to cmd+p is not as easy as it looks like. Because cmd+p has been registered to do the “Print Job”. Replacing the keymap on .vimrc (vim configuration file) didn’t solve the problem.

On Stackoverflow, someone explain that .vimrc are loaded after the gui has been created. So we have to disable the key to be registered as print job before the gui launch.

To do this, we simply put our configuration into .gvimrc not .vimrc. And the configuration should be look like this:

if has("gui_macvim")
	macmenu &File.Print key=<nop>

And then, on our .vimrc

if has("gui_macvim")
	let g:ctrlp_map = '<D-p>'
	let g:ctrlp_cmd = 'CtrlP'

Restart your macvim, and voilaaaaaa!!!