1

我正在使用带有omnifunc 的AutoComplPop。

而不是Enter在自动完成弹出窗口中自动完成选择,我想使用Ctrl+ Enter(或其他组合)并Enter像往常一样表现。

最后一点很重要:如果我想插入回车并且自动完成弹出窗口突出显示了某些内容,我将不得不按两次回车键。

那么:如何重新映射自动完成键?

4

1 回答 1

1

我不认为 AutoComplPop 插件对Enter键有任何作用;相反,这是完成弹出窗口可见时的默认行为。见:h popupmenu-keys

  The behavior of the <Enter> key depends on the state you are in:
  first state:      Use the text as it is and insert a line break.
  second state:     Insert the currently selected match.
  third state:      Use the text as it is and insert a line break.

只是 AutoComplPop 默认选择第一个匹配项(内置完成不这样做)。

回答你的问题(虽然我不完全明白你想要什么行为):

弹出菜单没有特殊模式,您必须使用 a:help map-expr并使用 . 检查弹出菜单pumvisible()。例如,要进行<Enter>中止完成并插入换行符:

:inoremap <expr> <CR> pumvisible() ? '<C-e><CR>' : '<CR>'
于 2013-06-11T12:45:39.073 回答