On Mon, May 07, 2007 at 04:33:37PM +0200, Warren Crossing wrote: > even tried it with javac 1.5
I'm sortof baffled; it works for me, java 1.6 and 1.5 alike. May I send you a screenshot? The contents of my quickfix window look like this on code trying to resemble yours: src/main/java/ntc/mmx/storage/impl/StorageFacilityImpl.java|24 col 21| ')' expected src/main/java/ntc/mmx/storage/impl/StorageFacilityImpl.java|24 col 29| ';' expected ':set efm? makeprg?' replies: errorformat=%Z%f:%l: %m,%A%p^,%-G%*[^sl]%.%# makeprg=javac % 2>&1 \| vim-javac-filter 'vim-javac-filter' contains: #!/bin/sed -f /\^$/s/\t/\ /g;/:[0-9]\+:/{h;d};/^[ \t]*\^/G; And with this file, 'Broken.java': public class Broken { public static void main(String args[]) { missing(); } } The result in my quickfix window is: || symbol : method missing() || location: class Broken Broken.java|3 col 4| cannot find symbol My 'sed', 'javac', and 'vim' are all the same or very similar versions as yours. > however I don't fully understand the line move part of the sed script, > can you explain what the results of the sed script would be on the > previous javac error for example? The results look just as they should. The (filename) lines were moved to directly following the "pointer" lines. The reason d'etre for the script is that javac errors normally take the form: (filename):(line number):(error) symbol: blah (sometimes) location: blah (sometimes) (tabs or spaces)(source code) (tabs or spaces)(spaces) ^a ... (filename):(line number):(error) (tabs or spaces)(source code) (tabs or spaces)(spaces) ^ ... (n) error(s) With errorformat you can tell vim to match the (filename...) line as the beginning of a multi-line error, but the (source code) line that follows it, that we want to throw away, makes it confused, and unable to collect the column information given by the "pointer line." I found by exerimentation that if there's no "throwaway" lines between the start and end of a multi-line error, the pointer line data is parsed correctly. But I don't want to throw away those symbol: location: lines. So rather than delete those lines, I move the (filename) line to *below* the pointer line and change the errorformat accordingly. The sed script accomplishes the line-moving task. And if there's a simpler way, I'd adopt it immediately ;) > Also FYI to replace characters you can use > > tr -t '\t' ' ' Thanks, I'm aware. I figured since I have to invoke sed anyway for line-moving, I'd take care of the substitution issue there too. Good luck -Mike