vimerrorformat

issue with setting up vim errorformat


My compiler and lint tools put out errors in two different formats. I decided to incrementally setup my errorformat, first for lint and then add a pattern for a compiler.

Here is the lint output line I'm trying to match to

"C:\Documents and Settings\user\Projects\MyProject\trunk\src\myfile.c",126  Info 754: local structure member 'myStructMember' (line 126, file C:\Documents and Settings\user\Projects\MyProject\trunk\src\myfile.c) not referenced

My first attempt was

set errorformat=\"%f\"\\,%l\ \ %t%s

And it worked.

Then I tried to set it up as follows

set errorformat=\"%f\"\\,%l\ \ %t\ %s

And it stopped working.

Does anybody know what is the issue? I did read through the documentation but it didn't help.

Any help is appreciated.


Solution

  • " Match the filename and line number
    let &errorformat = '"%f"\,%l'
    
    " Match white space, first character of error type, the rest of the characters
    " of the error type, and white space again.
    let &errorformat .= '%*\s%t%*\w%*\s'
    
    "Match error number, whitespace and error message.
    let &errorformat .= '%n:%*\s%m'