Question

I would like to map ctrl+leader key. Is it possible?

Tried: :nnoremap <c-leader> :CtrlP<CR>

And it does not work.

(ctrlp bindings conflict with yankring bindings)

Was it helpful?

Solution

<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>

OTHER TIPS

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>

For example to map leader key to space try this ...

let mapleader=" "

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top