Vim 中 MenuPopup 的 autocmd 事件
目标
在 ins-completion 期间将 k 和 j 映射到
,像这样:
和
autocmd MenuPopup inoremap k <down>
autocmd MenuPopup inoremap j <up>
当 MenuPopup
消失时撤消临时映射:
autocmd MenuPopupGone iunmap k
autocmd MenuPopupGone iunmap j
问题
什么是正确的 autocmd
事件MenuPopupGone
?据我从 :help event
了解到,MenuPopupGone
没有这样的事件。
Objective
Map k and j to <up>
and <down>
during ins-completion
, like so:
autocmd MenuPopup inoremap k <down>
autocmd MenuPopup inoremap j <up>
And undo the temporary mapping when the MenuPopup
is gone:
autocmd MenuPopupGone iunmap k
autocmd MenuPopupGone iunmap j
Question
What is the correct autocmd
event for MenuPopupGone
? As far as I know from :help event
, there is no such event for MenuPopupGone
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MenuPopup
事件不适用于插入模式完成菜单,而是用于单击鼠标右键出现的菜单。要在完成菜单可见时更改映射,请使用计算
pumvisible()
的
映射:The
MenuPopup
event is not for the insert-mode completion menu, but for the menu that comes up with a right mouse button click.To change mappings when the completion menu is visible, use
<expr>
mappings that evaluatepumvisible()
: