How do I attach a callback to :NeomakeProject so that :cwindow is executed after compilation finishes?

i.e. I'm too lazy and want everything (open the error list) to happen automatically. (currently I'm opening :cwindow with a shortcut)

/callback in :help neomake shows that neomake#Make() accepts a callback as third argument but this doesn't seem to be connected to my problem as it's a function, called internally by :Neomake

Googling for "neovim job control" shows that callbacks are set as argument to the jobstart function. A search for jobstart in the neomake repository shows that neomake sets neomake#MakeHandler as a callback. And the fact that this function is 98 lines long stopped my further research.

2 Answers 2


Neomake runs a user autocmd called NeomakeFinished when it's done. It sets the context variable: g:neomake_hook_context.file_mode. If it's 1 it's using the location list.

If you only want it to run when it's finished with a project:

autocmd User NeomakeFinished if !g:neomake_hook_context.file_mode | cwindow | endif

There is also an option:


This setting will open the |loclist| or |quickfix| list (depending on whether it is operating on a file) when adding entries. A value of 2 will preserve the cursor position when the |loclist| or |quickfix| window is opened. Defaults to 0.

  • It worked with g:neomake_open_list. Thanks!
    – Al.G.
    Commented Jul 10, 2016 at 16:07

I don't know first hand if it works with your fork but the following snippets works perfectly in real Vim:

augroup qf

    " automatically open the location/quickfix window after :make, :grep,
    " :lvimgrep and friends if there are valid locations/errors
    autocmd QuickFixCmdPost [^l]* cwindow
    autocmd QuickFixCmdPost l*    lwindow
augroup END
  • Yes, it works for :make but not for :Neomake. Thank you anyway :)
    – Al.G.
    Commented Jul 10, 2016 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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