How to customize the mappings inside CtrlP's prompt - VIM -


i'm using ctrlp plugin.

according ctrlp's doc should able remap this

  let g:ctrlp_prompt_mappings = { 'prtselectmove("k")': ['<c-u>', '<up>'] }   let g:ctrlp_prompt_mappings = { 'prtselectmove("j")': ['<c-d>', '<down>'] }   let g:ctrlp_prompt_mappings = { 'prtdelete()'       : ['<c-k>', '<del>'] }   let g:ctrlp_prompt_mappings = { 'prtexit()'         : ['<c-l>', '<esc>'] } 

but doesn't work, tried few variations - still getting same result.

i want remap 4 lines (from doc):

\ 'prtdelete()':          ['<del>'], \ 'prtselectmove("j")':   ['<c-j>', '<down>'], \ 'prtselectmove("k")':   ['<c-k>', '<up>'], \ 'prtexit()':            ['<esc>', '<c-c>', '<c-g>'], 

+++update+++

  let g:ctrlp_prompt_mappings = {   \ 'prtdelete()': ['<c-k>', '<del>'],   \ 'prtexit()': ['<esc>', '<c-l>', '<c-g>'],   \ 'prtselectmove("k")': ['<c-u>', '<up>'],   \ 'prtselectmove("j")': ['<c-d>', '<down>'],   \} 

only <c-u> work. <c-k>, <c-l>, <c-d> doesn't work.

when :echo g:ctrlp_prompt_mappings

{'prtdelete()': ['<c-k>', '<del>'], 'prtselectmove("j")': ['<c-d>', '<down>'], 'prtexit()': ['<esc>', '<c-l>', '<c-g>'], 'prtselectmove("k")': ['<c-u>', '<up>']} 

+++update2+++

  let g:ctrlp_prompt_mappings = {   \ 'prtexit()':   ['<c-l>', '<esc>'],   \ 'prtselectmove("k")': ['<c-u>', '<up>'],   \ 'prtselectmove("j")': ['<c-d>', '<down>'],   \ 'prtbs()': ['<c-k>', '<bs>', '<c-]>'],   \ 'togglebyfname()': [''],   \ 'prtcurright()': ['<right>'],   \} 

everything works. ( <c-l>, <c-d> ) started working because remove them

  \ 'togglebyfname()':      [''],   \ 'prtcurright()':        ['<right>'], 

if copy suggested solution clipboard,

  let g:ctrlp_prompt_mappings = { 'prtselectmove("k")': ['<c-u>', '<up>'] }   let g:ctrlp_prompt_mappings = { 'prtselectmove("j")': ['<c-d>', '<down>'] }   let g:ctrlp_prompt_mappings = { 'prtdelete()'       : ['<c-k>', '<del>'] }   let g:ctrlp_prompt_mappings = { 'prtexit()'         : ['<c-l>', '<esc>'] } 

, , "source" using :@+, notice overwriting variable 3 times, last line remains:

:echo g:ctrlp_prompt_mappings  output: {'prtexit()': ['<c-l>', '<esc>']} 

it better if follow pattern described @ documentation:

 *'g:ctrlp_prompt_mappings'* use customize mappings inside ctrlp's prompt liking. need keep lines you've changed values (inside []): > let g:ctrlp_prompt_mappings = { \ 'prtbs()': ['<bs>', '<c-]>'], \ 'prtdelete()': ['<del>'], \ 'prtdeleteword()': ['<c-w>'], \ 'prtclear()': ['<c-u>'], \ 'prtselectmove("j")': ['<c-j>', '<down>'], \ 'prtselectmove("k")': ['<c-k>', '<up>'], ... \} 

each block of braces comprises dictionary. approach defines 4 different dictionaries , assign of them same variable, while form described documentation defines single 1 multiple key/value pairs. check :help dict more information.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -