我正在使用ctrlP插件。
根据ctrlp的文档,我应该能够像这样重新映射
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>'] }
但这是行不通的,我尝试了几种变体-仍然得到相同的结果。
我想重新映射这四行(来自doc):
\ 'PrtDelete()': ['<del>'],
\ 'PrtSelectMove("j")': ['<c-j>', '<down>'],
\ 'PrtSelectMove("k")': ['<c-k>', '<up>'],
\ 'PrtExit()': ['<esc>', '<c-c>', '<c-g>'],
+++更新+++
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>'],
\}
只<c-u>
起作用。<c-k>, <c-l>, <c-d>
不起作用。
当我做 :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>']}
+++更新2 +++
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>'],
\}
一切正常。(<c-l>, <c-d>
)开始工作,因为我将其从
\ 'ToggleByFname()': [''],
\ 'PrtCurRight()': ['<right>'],
如果您将建议的解决方案复制到剪贴板,
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>'] }
,然后使用进行“源”处理:@+
,您会发现实际上是将变量覆盖了3次,因此仅保留了最后一行:
:echo g:ctrlp_prompt_mappings
output: {'PrtExit()': ['<c-l>', '<esc>']}
如果遵循文档中描述的模式,那就更好了:
*'g:ctrlp_prompt_mappings'*
Use this to customize the mappings inside CtrlP's prompt to your liking. You
only need to keep the lines that you've changed the 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>'],
...
\}
每个大括号包含一个字典。您的方法定义了四个不同的字典,并将它们全部分配给同一个变量,而文档描述的形式定义了一个具有多个键/值对的字典。检查:help dict
更多信息。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句