Thursday, October 15, 2015

Capture output of :make

Is it possible to capture the output of :make in order to show it
in a buffer (when there are no errors)?

My use case is as follows: I have some files that I want to process
to produce reports. But the files may contain syntax errors, in which
case I'd like such errors to be sent to a quickfix window.

What I am doing now is setting the global errorformat and using cexpr,
along these lines:

let output = system(cmd)
if v:shell_error
set errorformat=%f:%l:%m
cexpr output
copen
else
bo new
call append(0, output)
endif

This works, but I have to set the global errorformat, which I am not
sure is a good thing (say, if I want to distribute the code as a plugin).
Is there a better way?

Nicola


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: