2013-03-07 135 views
1

我的编译器和lint工具以两种不同的格式输出错误。我决定增量设置我的错误格式,首先为lint,然后为编译器添加一个模式。设置vim错误格式问题

这里是皮棉输出线我想匹配

"C:\Documents and Settings\user\Projects\MyProject\trunk\src\myfile.c",126 Info 754: local structure member 'myStructMember' (line 126, file C:\Documents and Settings\user\Projects\MyProject\trunk\src\myfile.c) not referenced 

我第一次尝试是

set errorformat=\"%f\"\\,%l\ \ %t%s 

和它的工作。

然后我试图将其设置如下

set errorformat=\"%f\"\\,%l\ \ %t\ %s 

它停止工作。

有谁知道这是什么问题? 我没有阅读文档,但没有帮助。

任何帮助表示赞赏。

+0

所以它是正确匹配的'信息754',两者之间没有空格但不匹配? – 2013-03-07 20:32:38

+0

我想出了这个问题。 %t只匹配第一个字符。因此,如果%t \%s匹配错误类型的第一个字符,则匹配空格,然后匹配字符串。要使其工作,我必须将其更改为%t%* \ w%* \ s%s – flashburn 2013-03-08 00:03:54

+1

您应该在下面发布您的解决方案作为答案 – 2013-03-08 00:28:23

回答

0
" Match the filename and line number 
let &errorformat = '"%f"\,%l' 

" Match white space, first character of error type, the rest of the characters 
" of the error type, and white space again. 
let &errorformat .= '%*\s%t%*\w%*\s' 

"Match error number, whitespace and error message. 
let &errorformat .= '%n:%*\s%m'