首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何让vim为快速修复窗口解析我的多行错误信息?

如何让vim为快速修复窗口解析我的多行错误信息?
EN

Stack Overflow用户
提问于 2013-07-10 08:42:24
回答 3查看 1.7K关注 0票数 4

我希望使用make在vim下运行我的应用程序,并且希望quickfix窗口显示我的错误。

所以我有这样的格式,它首先以Error:开头,然后是文件名,用:分隔行和列,然后在下一行上,将有一条没有特殊格式的多行消息,然后消息将以ErrorEnd结束。

下面是一个例子:

代码语言:javascript
运行
复制
Error: /somefile/something/something.c:12:123
SOME MESSAGE 
ANOTHER HELPFUL MESSAGE
ANOTHER MESSAGE
ErrorEnd

我有点迷失在如何让它与这些行匹配的文档中。每件事看起来都很令人困惑,而且示例并不像这个。我知道如何让它匹配第一行,但不知道如何让它匹配下一行作为错误消息。所以问题是,什么是可以解析所有内容的错误格式字符串。

EN

Stack Overflow用户

发布于 2013-07-12 16:50:33

从vim errorformat帮助页面:

代码语言:javascript
运行
复制
Multi-line messages             *errorformat-multi-line*

It is possible to read the output of programs that produce multi-line
messages, i.e. error strings that consume more than one line.  Possible
prefixes are:
    %E      start of a multi-line error message
    %W      start of a multi-line warning message
    %I      start of a multi-line informational message
    %A      start of a multi-line message (unspecified type)
    %>      for next line start with current pattern again |efm-%>|
    %C      continuation of a multi-line message
    %Z      end of a multi-line message
These can be used with '+' and '-', see |efm-ignore| below.

Using "\n" in the pattern won't work to match multi-line messages.

Example: Your compiler happens to write out errors in the following format
(leading line numbers not being part of the actual output):

     1  Error 275 
     2  line 42 
     3  column 3 
     4  ' ' expected after '--' 

The appropriate error format string has to look like this:
   :set efm=%EError\ %n,%Cline\ %l,%Ccolumn\ %c,%Z%m

编辑:啊,你的意思是多行错误。正确的。这更难。

票数 3
EN
查看全部 3 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17560652

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档