vimerrorformat

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. 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

Solution

  • Here is what I would try:

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

    Please look at :h errorformat for more information.

    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.