0

I'm using the default errorformat, but messages starting with "In file included from" aren't giving me the quickfix output I expect

For example:

|| [  0%] Building CXX object CMakeFiles/blah/FooBar.cpp.o
|| In file included from /Users/me/Projects/FooTron9000/repo/src/FooBar.cpp:8:
/Users/me/Projects/FooTron9000/repo/src/FooHeader.h|5 col 10| fatal error: 'DoesNotExist.h' file not found                                                                                                                              
|| #include "DoesNotExist.h"
||          ^~~~~~~~~~~~~~~~~~~~~~~~~~
|| 1 error generated.

I actually want to be able to jump to line 8 of /Users/me/Projects/FooTron9000/repo/src/FooBar.cpp, not just line 5 of FooHeader.h. How can I set that up?

7
  • vim.fandom.com/wiki/Errorformats
    – Maxim Kim
    Commented Aug 12, 2020 at 7:06
  • :h :compiler to choose one of predefined patterns
    – Matt
    Commented Aug 12, 2020 at 7:07
  • 1
    @MaximKim Yup, read that before posting. Still stuck. I think there might be some default errorformats in there which are deliberately excluding the lines I want, but I can't work out how to get rid of them. errorformat-=blahblahblah in my vimrc isn't doing it. Commented Aug 12, 2020 at 23:36
  • 1
    @Matt Tried that. No luck. The gcc compiler format specifically seems to want to exclude those lines (also I think I'm using Clang (XCode)? Not sure if it has the same output, but I think so). Commented Aug 12, 2020 at 23:37
  • you have to build errorformat that handles it for you. Examples are in the link I have provided earlier. :h errorformat also has examples.
    – Maxim Kim
    Commented Aug 13, 2020 at 5:31

1 Answer 1

1
let &efm .= ',%+GIn file included from %f:%l%*[\,:]'

The command let &efm .= ',Z' appends ,Z to 'errorformat' (abbr. 'efm').

Here, %+G means use the whole string as message. It is used instead of %m.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.