如何在 Vim 自动完成后自动删除预览窗口?
我正在使用 omnifunc=pythoncomplete
。自动完成单词(例如,os.
)时,我会按预期获得符合条件的类成员和函数的列表,以及包含有关所选成员的文档的暂存缓冲区预览窗口或函数。这很棒,但是选择我想要的功能后,预览窗口仍然存在。
我可以用 :pc
摆脱它,但我希望它在我选择我的函数后自动消失,就像 Eclipse 一样。我已经尝试过 completeopt
但无济于事。
I'm using omnifunc=pythoncomplete
. When autocompleting a word (e.g., os.<something>
), I get the list of eligible class members and functions, as expected, as well as a scratch buffer preview window with documentation about the selected member or function. This is great, but after selecting the function I want, the preview window remains.
I can get rid of it with :pc
, but I'd like it just to automatically disappear after I've selected my function, a la Eclipse. I've played around with completeopt
but to no avail.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
将以下内容放入您的 vimrc 中:
Put the following in your vimrc:
尽管已经有一个可接受的答案,但我直接从文档中找到了这个答案,该答案适用于任何存在此问题的插件。
Even though there is already an accepted answer I found this directly from the docs which will work for any plugin that is having this issue.
如果您安装了 supertab 插件,则有一个名为
supertab-closepreviewonpopupclose
的选项。将以下内容放入您的 .vimrc 中:
If you have the supertab plugin installed, there is an option called
supertab-closepreviewonpopupclose
.Put the following in your .vimrc:
我不知道如何自动关闭它,但你可以输入
手动关闭暂存预览。
I don't know how to close it automatically, but you can type
to close the scratch preview manually.
您可以添加以下映射以使某些键尝试关闭预览窗口。
在插入模式下完成后,您还可以使用自动命令关闭预览窗口:
You could throw in the following mappings to have certain keys try to close the preview window.
You could also use autocommands to close the preview window when you're finished in insert mode:
我知道这个问题很老了,但是经过几天的寻找“干净”的解决方案后,我刚刚找到了完成这项工作的 CompleteDone 自动功能:
I know this question is very old, but after days of looking for a "clean" solution I just found the CompleteDone autofunction that does the job:
您可以在
.vimrc
中输入:You can type that in the
.vimrc
: