I have found a solution.
The solution works, but is ugly.
The key should automatically call the function errormarker SetErrorMarkers()at the right time.
I tried Peter Rinker's solution, but it turned out that I AsyncCommandQuickFixCmdPostshot too early. The quickfix list is not yet installed. Therefore SetErrorMarkers()does nothing.
I read the manual AsyncCommandand traced some code, AsyncMakeis actually a wrapper that calls
asynccommand
with
asynccommand
// where asynchandler
, asynchandler#qf , asynchandler#qf asynccommand#done asynccommand.vim 92, asynchandler#qf.
function! asynccommand
" Called on completion of the task
let r = s:receivers[a:temp_file_name] "handlers are registered in s:receivers
if type(r.dict) == type({})
call call(r.func, [a:temp_file_name], r.dict)
else
call call(r.func, [a:temp_file_name])
endif
unlet s:receivers[a:temp_file_name]
delete a:temp_file_name
endfunction
!
101 SetErrorMarkers()
...
unlet s:receivers[a:temp_file_name]
if exists("*ExposeSetErrorMarkers")
call ExposeSetErrorMarkers()
endif
delete a:temp_file_name
...
, ExposeSetErrorMarkers() not SetErrorMarkers(). SetErrorMarkers() script, script. ExposeSetErrorMarkers() errormarker.vim, .
function! ExposeSetErrorMarkers()
call s:SetErrorMarkers()
endfunction
, .vimrc
au BufWritePost *cpp AsyncMake
au BufWritePost *cc AsyncMake
au BufWritePost *h AsyncMake
AsyncMake .
! , : P