gpt4 book ai didi

Vim 将诊断消息打印到消息缓冲区并阻止 "press Enter to continue"提示

转载 作者:行者123 更新时间:2023-12-04 04:50:38 24 4
gpt4 key购买 nike

我正在努力改进 vim indentfinder脚本(我作为 fork 托管 here ),我希望插件在消息日志中放置一个条目,说明它检测到的当前缓冲区缩进的内容,但我不想要它用烦人的绿色“Press ENTER or type command to continue...”提示挂断文件的打开,因为用户不会关心这个小消息,用户通常只想在之后查看它- 事实上,如果打开的文件的缩进检测不正确等。

如何做到这一点?

silent !echom

防止消息进入消息缓冲区。

echo

永远不会进入缓冲区并且触发回车提示。

我试图链接一个| echom 调用后正常的 ^M,希望发送 Enter 键以关闭提示,但这不起作用。

最佳答案

嗯,这很酷。

我看了这个文档:

                                         :echo-redraw         
A later redraw may make the message disappear again.
And since Vim mostly postpones redrawing until it's
finished with a sequence of commands this happens
quite often. To avoid that a command from before the
":echo" causes a redraw afterwards (redraws are often
postponed until you type something), force a redraw
with the :redraw command. Example:

:new | redraw | echo "there is a new window"

不受欢迎的提示实际上是 Vim 试图变得友善,所以如果我们只是告诉它我们想要什么,每个人都会很高兴!

将其应用于插件 (redraw | echom ...),效果很好。

关于Vim 将诊断消息打印到消息缓冲区并阻止 "press Enter to continue"提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17506495/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com