Michael F. Lamb wrote: > I've put some spare time into an errorformat string and a filter script > which I think makes plain-old javac compilation (read: not using JUnit, > not using Ant) quite a bit nicer than the examples from :help > errorformat-javac, without being too heavy or complicated. I've tested > this with only Vim 7.0.122 on Linux, Sun Java 1.6.0, and only minimally > at that. > > It correctly discovers the column number even if you use tabs in your > source code, doesn't fill the "error message" variable with extra crud, > shows the "symbol:" and "location:" lines in the quickfix window, but > properly skips over them when doing :cnext and :cprevious. Note that > "symbol:" and "location:" will appear above their related error message > in the quickfix window. > > Here's the sed script to filter the output from javac. I named it > 'vim-javac-filter' and placed it in my path. > > #!/bin/sed -f > /\^$/s/\t/\ /g;/:[0-9]\+:/{h;d};/^[ \t]*\^/G; > > In English, that sed script: > - Changes tabs to spaces and > - Moves the line with the filename, line number, error message to just > after the pointer line. That way, the extra gunk between doesn't > break vim's notion of a "multi-line message" and also doesn't force > us to include that gunk as a "continuation of a multi-line message." > > Here's the corresponding efm: > > :setlocal errorformat=%Z%f:%l:\ %m,%A%p^,%-G%*[^sl]%.%# > > To make it work using ":make": > > :setlocal makeprg=javac\ %\ 2>&1\ \\\|\ vim-javac-filter
Assuming this works well, it's only for Unix. Thus I would add it to ":help errorformat-javac" instead of replacing the existing example. How about this: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Here is an alternative from Michael F. Lamb 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 tabs to spaces and - Moves the line with the filename, line number, error message to just after the pointer line. That way, the extra gunk between doesn't break vim's notion of a "multi-line message" and also doesn't force us to include that gunk as a "continuation of a multi-line message." -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -- DENNIS: Look, strange women lying on their backs in ponds handing out swords ... that's no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///