I'm struggling to get vim (8.0 (2016 Sep 12)) to parse the output of my build system, and need help with defining my errorformat. The default gcc efm appears to not be matching any lines, so in quickfix I see basically every line of make output, but the lines that actually contain errors show up with odd characters inserted.
Example make output:
make: Entering directory '/home/tblack/SourceRAM/la/Blocks'
ZYNQ_GPP src/avpcva.cpp
src/avpcva.cpp: In destructor 'virtual Blocks::AVPCVA::~AVPCVA()':
src/avpcva.cpp:152:49: error: 'class AVBC::STC' has no member named 'getHandle'
uint16_t handle = stIter->second->getHandle();
^
For the above make output, the quickfix list shows:
|| make: Entering directory '/home/tblack/SourceRAM/la/Blocks'
|| ZYNQ_GPP src/avpcva.cpp
|| ^[[01m^[[Ksrc/avpcva.cpp:^[[m^[[K In destructor '^[[01m^[[Kvirtual Blocks::AVPCVA::~AVPCVA()^[[m^[[K':
|| ^[[01m^[[Ksrc/avpcva.cpp:152:49:^[[m^[[K ^[[01;31m^[[Kerror: ^[[m^[[K'^[[01m^[[Kclass AVBC::STC^[[m^[[K' has no member named '^[[01m^[[Kget Handle^[[m^[[K'
|| uint16_t handle = stIter->second->getHandle();
|| ^[[01;32m^[[K ^^[[m^[[K
The default errorformat for vim's gcc compiler plugin (amazingly) does not appear to beconfigured to support multi-line output (doesn't include any of %E, %C, %Z). I suspect that I just need to adjust my errorformat accordingly, but:
- Would my using the default efm explain the odd characters in my quickfix?
- I could use help with the specification of an efm that will correctly parse my make output. I have been reading the vim docs and browsing the web for days and still not making headway on demystifying and troubleshooting multiline errorformats in vim.
I took a stab at this, using the errorformat below. The first line attempts to define my multi-line error format start(%E)/continue(%C)/end(%Z).
set errorformat =%E%f:%l:%c:\ %trror:\ %m,%-C,%-Z%p^
set errorformat+=%D%*\\a:\ Entering\ directory\ [`']%f'
set errorformat+=%X%*\\a:\ Leaving\ directory\ [`']%f'
But it does not result in any different behavior from what I described above.
Thank you.
^[
is the notation for an escape character. So, for example:^[[01m
isesc[01m
or CSI 1 m, which is the escape sequence for the start of some bold text and, later in the line,^[[m
is CSI m which is the same as CSI 0 m: return to normal (non-bold) text. See en.wikipedia.org/wiki/ANSI_escape_code#Escape_sequences if you fancy translating the rest of them, too.