Vim 错误格式
我阅读了文档,但更加困惑。
我有编译器生成的以下错误:
rot;
^
"cpp\c1.cpp", line 13: error(114): identifier
"rot" is undefined
1 error detected in the compilation of "c1.cpp".
我知道如何检测给出错误行的行,但是我在错误列表中收到大量额外无用的信息,并且错误消息分为两行,我更喜欢合并。
我的起始错误格式是:
:set efm=\"%f\"\\,\ line\ %l:\ error(%n):\ %m
既然我们已经做到了,是否有一种快速方法来测试 efm,而无需一直运行 make?
I read the docs, but got even more confused.
I have the following error generated by the compiler:
rot;
^
"cpp\c1.cpp", line 13: error(114): identifier
"rot" is undefined
1 error detected in the compilation of "c1.cpp".
I know how to detect the line where the error line is given, but I get loads of extra useless info in my errorlist, and the error message is split in two lines, whcih i would prefer to merge.
My starting errorformat is:
:set efm=\"%f\"\\,\ line\ %l:\ error(%n):\ %m
Since we are at it, is there a quick way of testing the efm without resorting to run make all the time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先我讲一下调试。不幸的是,没有特别简单的方法来做到这一点,但一种有用的可能性是运行 make 并将输出吐入文件中,然后:
关于制作错误格式,这确实需要一些尝试和错误。您可以将 %A、%C 和 %Z 用于多行消息,并且可以使用 %-G 忽略内容。顺序非常重要,请注意有时 %C 甚至 %Z 出现在 %A 之前!就您的情况而言,您也许可以使用下面的 efm 来达到目的。我倾向于使用
let &efm =
和let &efm .=
而不是设置,因为您不必转义每个空格或引号,并且可以构建逐渐起来。它也更具可读性。First of all, I talk about debugging. Unfortunately, there's no particularly easy way of doing it, but one useful possibility is to run make and spit the output into a file and then:
Regarding making the errorformat, this does require a bit of trial and error. You can use %A, %C and %Z for multiline messages and you can use %-G to ignore stuff. The order is very important and note that sometimes the %C or even %Z come before the %A! In your case, you may be able to get somewhere with the efm below. I tend to use
let &efm =
andlet &efm .=
rather than set as you don't have to escape every space or quotation mark and you can build it up gradually. It's also much more readable.