1

Whenever I run :make in Vim, it always takes control away from my buffer, places me in a temporary view where I see the makeprg's output and then prompts me to "Press ENTER or type command to continue". Is there a way so I can run :make without leaving my current buffer?

For context, I'm using pyunit to parse Python tracebacks, using make. WHen make is finished, it populates the traceback in my quickfix buffer. So I don't need to see the intermediary make output. Just the quickfix is all I want.

For context, I'm running something like this:

compiler pyunit
set makeprg=cat\ %
make
2

One way to do this natively in vim is to utilise system() or systemlist(). I'm not familiar with pyunit, but something like the following may help you get started.

function! MyMake() abort
    let l:efm = "%C %.%#,%A  File "%f"\, line %l%.%#,%Z%[%^ ]%\@=%m"
    let l:lines = systemlist("cat " . expand("%"))
    call setqflist([], " ", {"efm": l:efm, "lines": l:lines})
endfunction
1
  • This got me really close but l:efm only matches a single line. It doesn't create individual entries for each function call. I went with let l:efm = '%A File "%f"\, line %l\, in %o,%C %m,%Z' and it works perfectly now. Thank you! Feb 22 at 0:32
1

You can use tpope’s dispatch plugin and run :Make for an asynchronous make.

2
  • I tried this but unfortunately it doesn't work the same. Though I do use that plugin for other types of projects. Feb 21 at 9:32
  • 1
    @ColinKennedy Can you expand on how it doesn't work the same? Which part of it doesn't work for you?
    – filbranden
    Feb 21 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.