Question

The errors produced by ghc-mod are on a single line, where each line may potentially contain the <Nul> character, rendered as \@ by vim. I'd like to parse this for quickfix, but can't see how this might work with errorformat: the <Nul> character seems to truncate %m as if it were a new line, but using multiline syntax doesn't seem to be working to catch this case.

Is there a way to make errorformat parse <Nul>?

Was it helpful?

Solution

A program that carelessly outputs null characters in a Unix environment is just begging for trouble.

No, for all I see Vim cannot handle null characters when parsing output with 'errorformat'. (It is possible to add NULs to the errorformat string by prefixing them with CTRL-V, i.e. ^V^@, but this is useless.)

The work-around for output that isn't suited for Vim's errorformat is to add a filter to the 'makeprg' program and then use :make to populate the quickfix list:

:set makeprg=ghc-mod\ lint\ %\ \\\|\ tr\ -d\ '\\0'
:make

This hint can be found at the very end of :h error-file-format.

A much better solution is to simply not bother and use the popular ghcmod plugin that does this and much more.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top