简体   繁体   English

Vim的错误格式被忽略

[英]Vim's errorformat is ignored

I have a problem with Vim's (v7.3) errorformat. 我对Vim(v7.3)的错误格式有疑问。 Trying to set it to extract my C errors into quickfix. 尝试设置它以将我的C错误提取到quickfix。 The error pattern is probably well-known: 错误模式可能是众所周知的:

<file>:<line>:<column>: error: <message>

I am setting this errorformat: 我正在设置此错误格式:

:set errorformat=%f:%l:%c:\ error:\ %m

Then I run :make (and I have a modified :makeprg too). 然后我运行:make (并且我也修改了:makeprg )。 But the errorformat setting does not work. 但是errorformat设置不起作用。 It's like it's completely ignored, since the quickfix is filled up with more or less the entire compilation log file (not only errors). 就像它被完全忽略了一样,因为quickfix或多或少地充满了整个编译日志文件(不仅是错误)。

I even try to set the errorformat to some nonsense, like this: 我什至尝试将errorformat设置为废话,如下所示:

:set errorformat=sdkljfsldkfjsdlsdsd

Still, same result. 仍然,相同的结果。 The quickfix is filled up with hundreds of lines. 快速修复程序包含数百行。

Am I missing some magic turn on/off the errorformat setting? 我是否缺少打开/关闭错误errorformat设置的魔术功能?

Vim comes with many 'makeprg' and 'errorformat' settings that are already defined for different compilers/linters. Vim带有许多已经为不同的编译器/ 'makeprg'定义的'makeprg''errorformat'设置。 To use these settings use the :compiler command. 要使用这些设置,请使用:compiler命令。 You can use tab-completion (or <cd> to list out the options) to select one of the predefined definitions. 您可以使用制表符补全(或<cd>列出选项)来选择预定义的定义之一。

:compiler gcc

For more help see: 有关更多帮助,请参见:

:h :compiler
:h 'makeprg'
:h 'errorformat'
:h errorformat

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM