This plugin provides as one of its main features running makeprg
non-blocking either in the foreground or the background. Quote from :h dispatch
:
Leverage the power of Vim's compiler system without being constrained by
synchronicity.
The first command by vim-dispatch is :Make
(note the capital M
):
:Make [arguments] Using the current |:compiler| settings, dispatch a
build in the foreground. Adapter strategies vary, but
the goal is visibility without stealing focus. When
the build is complete, load the results into the
|quickfix| list and call |:cwindow|. This command is
preferred for shorter tasks like "build this file."
Let us consider this hello world perl file without errors which has as output two lines
#!/usr/bin/env perl
use strict;
use warnings;
print "Hello world\n";
print 42, "\n";
Set makeprg
as the OP suggested or manually with
:se mp=perl\ %
(abbreviated form of makeprg
is mp
)
Now press either m<CR>
or type :Make<CR>
from vim-dispatch. Perl will be executed and the
output will be available in the quickfix window without any additional lines:
The OP might be interested in having the quickfix window automatically be opened or keeping it open during scripting & running. Unfortunately, I could not figure this out. But someone has already filed this as a feature request on github.
Other plugins provide this but are heavier plugins such as:
vim-dispatch as of 2019
- supports vim8/neovim jobs (no tmux/screen/iterm needed anymore)
- nice (IMHO) default mappings
m<cr>
for :Make
m<Space>
for :Make<space>
(e.g. allows the user to run make debug
)
- and more (see
:h dispatch-maps
)
- Pending PR #250 and active branch to use vim8/neovim terminal for
:Start
to spawn interactive processes.
:make
but instead map K key to:!perl %
(or even:%w!perl
)