Howard Jess wrote:
A.J.Mechelynck wrote:
Howard Jess wrote:
Sample output is:

    Warning [flip.jss:7:10]: type mismatch:
        conflict between boolean [flip.jss:4:19]
        and string [flip.jss:7:10]
[ and more like that ]

which I think means:

    set errorformat=%[^[][%f:%l:%v]%m
[ but that didn't work ]

What about

    :set errorformat=%m[%f:%l:%v]%r

Sorry; I'm using Vim 6.3; it says:

    E373: Unexpected %r in format string

Perhaps this is a new feature in 7.0??

hj






I dunno. I've junked 6.3 when 6.4 came around, and though I maintained 6.4 and 7.0 alpha in parallel, now that the 7.0 "release" is out (with already 35 bugfixes) I've junked 6.4 too. Here's the paragraph about %r in 'errorformat' in the 7.0 help (quickfix.txt fot Vim 7.0, last change 2006 Apr 30):

        %r              matches the "rest" of a single-line file message %O/P/Q

Maybe it isn't appropriate (%O, %P and %Q refer to how to handle errorfiles where the filename is given once followed by several errors with line/col without filename). Is it allowable to have %m more than once in the format? Try

        :set efm=%m[%f:%l:%v]%m

If it doesn't work, you could pre-process the errorfile so as to move the [filename:123:45] part to the end of its line, and then match it with %m[%f:%l:%v] on the modified errorfile. Vim could do the preprocessing: (assuming the errorfile is called "make.log")

        :new make.log
        :1,$s/^\([^\[]*\)\(\[[^\]]*\]\)\(.*\)$/\1\3\2
        :x

explanation:
        1,$     from first to last line
        s/      substitute from
        ^       start-of-line
        \(      start of subpart 1
        [^\[]   not a [
        *       repeated zero or more times (as many as possible)
        \)      end of subpart 1
        \(      start of subpart 2
        \[      [
        [^\]]   not ]
        *       repeated zero or more times (as many as possible)
        \]      ]
        \)      end of subpart 2
        \(      start of subpart 3
        .*      zero or more of anything except a line break
        \)      end of subpart 3
        $       end of line
        /       replace by
        \1      subpart 1
        \3      subpart 3
        \2      subpart 2

Lines (if any) where there is no [] bracket pair are left unchanged. If there is more than one bracket pair in a line, the above moves the _first_ [] block to the end of the line.

Disclaimer: This is UNTESTED. Maybe I made a typo. It wouldn't be the first time ;-)


Best regards,
Tony.

Reply via email to