>> I've put some spare time into an errorformat string and a filter
>> script which makes plain-old javac compilation nicer than the
>> examples from :help errorformat-javac
>
> Assuming this works well, it's only for Unix. Thus I would add it
> to ":help errorformat-javac" instead of replacing the existing
> example.
I intended neither but I'd be happy for the former. It's not a
significant change, so feel free to omit my name for brevity.
If you're going to add this to the help files where lots of people will
read it, let me be a bit more professional. I've made minor language
changes to your modification of my text, below.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Here is an alternative for Unix that filters the errors first: >
:setl errorformat=%Z%f:%l:\ %m,%A%p^,%-G%*[^sl]%.%#
:setl makeprg=javac\ %\ 2>&1\ \\\|\ vim-javac-filter
You need to put the following in "vim-javac-filter" somewhere in your
path (e.g., in ~/bin) and make it executable: >
#!/bin/sed -f
/\^$/s/\t/\ /g;/:[0-9]\+:/{h;d};/^[ \t]*\^/G;
In English, that sed script:
- Changes single tabs to single spaces and
- Moves the line with the filename, line number, error message to just
after the pointer line. That way, the unused error text between
doesn't break vim's notion of a "multi-line message" and also
doesn't force us to include it as a "continuation of a multi-line
message."
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
I was concerned about this not being a cross-platform solution. I'd be
delighted if there were a more elegant (pure-vim) method. Is there a way
to have some vimscript modify the errorfile before parsing?