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?

  • :h :compiler to choose one of predefined patterns
    – Matt
    Aug 12 '20 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.
    – Len
    Aug 12 '20 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).
    – Len
    Aug 12 '20 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
    Aug 13 '20 at 5:31
let &efm .= ',%+GIn file included from %f:%l%*[\,:]'

let &efm .= ',Z' appends comma ',' and Z to option "efm"

"%+G" means use all string as message. It is used instead %m.

Raw "let" assigns variable. ".=" appends string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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