VIM: how to set "errorformat" in my specified error message format?

688 views Asked by At

In my system, we re-formatted all the build error message to have this format:

[2016-02-10 13:17:56.885597]    [WARNING]   [53171] [src/root/mylinux/test01.cpp:300]

As you could see, this format contain several parts:

1. The time stamp, day+hour+minute+second+microsecond
2. Some spaces and the [WARNING] or [ERROR] or [INFO] or [DEBUG], etc.
3. A process ID number like [53171]
4. The source file name + line number

I wish to use vim+quickfix to open this build error file, and navigate to source files+line number. So how to set 'errorformat' string in my .vimrc?

Thanks a lot.

1

There are 1 answers

0
Sato Katsura On BEST ANSWER

It's a relatively unpleasant thing to parse with errorformat to be sure, but you can do if you insist. One possible approach:

let &errorformat = '[%m]%*[ ][%t%*[A-Z]]%*[ ][%n]%*[ ][%f:%l]'