How to map <c-leader> in vim?

<Leader> is a special key notation in Vim; as such, it cannot be combined with modifiers such as C-. Assuming the default setting for it (i.e. \), you can use this:

nnoremap <c-\> :CtrlP<CR>

There are two issues, here:

  1. You didn't read CtrlP's documentation where you would have found this:

    Use this option to change the mapping to invoke CtrlP in Normal mode:
        let g:ctrlp_map = '<c-p>'
    
  2. <leader> is supposed to be a cross-platform alternative to using the common modifier keys (Alt, Ctrl, Shift, Cmd) in mappings.

    Normally, you would use <leader> in place of <Ctrl> as in:

    nnoremap <leader>p :CtrlP<CR>
    

This line in your ~/.vimrc will probably solve your problem:

let g:crtlp_map='<F11>'

Though it won't help much here are my mappings for CtrlP:

nnoremap <leader>f :CtrlP<CR>
nnoremap <leader>b :CtrlPBuffer<CR>
nnoremap <leader>m :CtrlPMRUFiles<CR>
nnoremap <leader>t :CtrlPTag<CR>

Tags:

Vim

Keymapping