The output of certain compilers (e.g., LaTeX) is incredibly difficult to parse using an error format string. There are always edge cases that leave out the context of errors. So, is there any way I can see the context of the error in the quickfix window? By more context, I mean the ability to jump to the position in the error log corresponding to an error.
1 Answer
I'm not aware of any built-in mechanism of jumping to the location of an error in the error log.
However, the default behaviour of errorformat
is to include all of the makeprg
output, so context can be seen in the quickfix window itself.
The errorformat
described in :help errorformat-LaTeX
includes a number of patterns specifically intended to hide matching lines from the quickfix window (see :help efm-ignore
):
\%-GSee\ the\ LaTeX%m,
\%-GType\ \ H\ <return>%m,
\%-G\ ...%.%#,
\%-G%.%#\ (C)\ %.%#,
\%-G(see\ the\ transcript%.%#),
\%-G\\s%#,
Removing these should result in the entire log being displayed.
If that doesn't work, you could also try adding a catch-all pattern to the very end of your errorformat
:
set efm+=%+G%.%#
This will match ALL lines which have not already been matched by an earlier pattern in your errorformat
. The disadvantage of doing this is that commands like :cnext
and :cprevious
will no longer skip over these lines, as they would do if you left them unmatched.
(It's more usual to use the negative analogue of this: %-G%.%#
as a catch-all to remove all previously unmatched lines from the output.)
errorformat
setting?:help errorformat-LaTeX
. The thing is that, the error output produced by LaTeX is so garbled that parsing it using an error format becomes cumbersome. I know I could write a filter script that filters the error output, but I was wondering if I could use a rudimentary error format that'll list the all the errors (with/without the context) and then move to the relevant line in the error log from the QuickFix window.