简体   繁体   English

如何使用vim的错误格式%*来匹配正则表达式。*?

[英]How to use vim's errorformat %* to match a regex .* equivalent?

I'd like to use vim's errorformat to match the output of my makeprg. 我想使用vim的errorformat来匹配我的makeprg的输出。 However it looks like the match should be a complete match, therefore I need to use .* regex like matchers. 但是看起来匹配应该是完全匹配,因此我需要像匹配器一样使用.*正则表达式。 So far I've found %*[^ ] the closest, but I need to match spaces as well. 到目前为止,我发现%*[^ ]最接近,但是我还需要匹配空格。

To be more particular: I want to match an output like this: 更具体地说:我想匹配这样的输出:

|| Assertion failed: (it != c.end()), function Foo, file /Users/Me/Path/to/MyPath, line 30.

So far I tried with this (not working): 到目前为止,我尝试了此操作(不起作用):

:set errorformat+=,%*[]file\ %f\\,\ line\ %l

Here is what I would try: 这是我会尝试的方法:

set errorformat=\|\|%m\\,\ file\ %f\\,\ line\ %l.

Please look at :h errorformat for more information. 请查看:h errorformat以获取更多信息。

To make it easier to debug these kind of things it is nice to save the error output into a file and use :cgetfile if using :make is too time consuming. 为了使调试这类事情更加容易,如果使用:make太耗时,最好将错误输出保存到文件中并使用:cgetfile

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

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