When I run:
:execute 'NeomakeSh! ' . &makeprg
When command is done I expect, that my errorformat will work as it does with :Neomake!, but it does. Also, while command is running it would be nice if it would automatically scroll when more output is produced.
Set errorformat:
set errorformat=\ %#File\ \"%f\"\\,\ line\ %l%m
set errorformat+=\@File\:\ %f
Set makeprg:
set makeprg=env/bin/py.test\ -vvx\ --tb=native\ tests.py
Create tests.py file:
def test_me():
assert False
Set up environment:
:term python -m venv env && env/bin/pip install pytest
Run :Neomake! and quickfix window should interpret output correctly according to errorformat.
Run :execute 'NeomakeSh! ' . &makeprg, and the output in quickfix window does not highligh lines.
Not sure, but this might be related: https://github.com/neomake/neomake/issues/1138
The main problem is that the errorformat gets set to %m unconditionally with NeomakeSh: https://github.com/neomake/neomake/blob/97163ec310240bcfd39af6907eed17ae024e095c/autoload/neomake.vim#L2625
It is meant to run a shell command, and therefore everything should be displayed.
So in your case, for running &makeprg, Neomake! appears to be what you want, no?
Also, while command is running it would be nice if it would automatically scroll when more output is produced.
Nice idea.. I've looked a bit into this (using :NeomakeSh! i=0; while true; do i=$((++i)); echo $i; sleep 1; done) and a minimal vimrc:
set runtimepath+=$PWD
let g:neomake_logfile = '/tmp/neomake.log'
let g:neomake_open_list = 2
It opens the quickfix list, and grows it until 10 lines. For this feature it would basically have to do :normal! G after the :cwindow always.
(I have found at least one issue with this, e.g. it mixes output order during command line / visual mode etc, and also cleans/removes the job then..)
btw: consider using https://github.com/janko-m/vim-test to run pytest.
And see also https://github.com/5long/pytest-vim-compiler (which I have local changes in case you're interested in this).
So in your case, for running &makeprg, Neomake! appears to be what you want, no?
Neomake! runs command in background and displays the output only, when command is done. While command is running there is no indication what is going on, and no output. In that regard I like NeomakeSh more, because it displays output instantly.
btw: consider using https://github.com/janko-m/vim-test to run pytest.
Thanks, I will look into it.
I like NeomakeSh more, because it displays output instantly.
I assume that's because of buffer_output.
Try :let g:neomake_makeprg_buffer_output = 0.
Tested with :let &makeprg = 'i=0; while true; do i=$((++i)); echo $i; sleep 1; done' and then :Neomake!.
I assume that's because of
buffer_output.
Try:let g:neomake_makeprg_buffer_output = 0.
Tested with:let &makeprg = 'i=0; while true; do i=$((++i)); echo $i; sleep 1; done'and then:Neomake!.
Thanks, that works! And solves my issue, because there is no need to use NeomakeSh. Not sure why output buffering is on by default.
Not sure why output buffering is on by default.
It is meant to provide better performance, and with Neovim gets turned into a job option even (so handlers are not invoked all the time).
I think it would be good if it would automatically get unbuffered if it takes longer than 0.5s for example, but that does not work if it is a job option already then.
That being said, it might be better to change the default indeed, and maybe only for project/quickfix mode (where it is expected to take longer anyway)?!
Most helpful comment
I assume that's because of
buffer_output.Try
:let g:neomake_makeprg_buffer_output = 0.Tested with
:let &makeprg = 'i=0; while true; do i=$((++i)); echo $i; sleep 1; done'and then:Neomake!.