How to map <c-leader> in vim?

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

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

And it does not work.

(ctrlp conflicts conflict with yankring bindings)

+6
source share
2 answers

<Leader> - a special key designation 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> 
+11
source

There are two problems here:

  • You have not read the CTRL documentation, wherever you find it:

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

    Usually, instead of <Ctrl> use <leader> , as in:

     nnoremap <leader>p :CtrlP<CR> 

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

 let g:crtlp_map='<F11>' 

Although this does not help, 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> 
+6
source

Source: https://habr.com/ru/post/919657/


All Articles