-
Notifications
You must be signed in to change notification settings - Fork 115
Cooperate with famous plugins
errormarker is a plugin to highlights and sets error markers for lines with compile errors. It is very handy and has more than 5K downloads in vim.org.
This plugin relys on an autocmd named QuickFixCmdPost make
which will be triggered at the end of ':make' command.
And we can trigger that autocmd by setting "g:asyncrun_auto" to "make":
let g:asyncrun_auto = "make"
This will execute an "doautocmd QuickFixCmdPost make" after background job finished and get errormaker
to read ahd process the content of quickfix window:
Now when any AsyncRun command completes, errormaker
will show the markers and ballons on the errors and warnings of source file. It's pretty cool.
Here you may ask, "it is a very useful autocmd why doesn't asyncrun trigger it by default ?"
Because many people may set a quickfixpost command to translate encoding in quickfix window like below, which will make a strange experience with asyncrun:
function QfMakeConv()
let qflist = getqflist()
for i in qflist
let i.text = iconv(i.text, "cp936", "utf-8")
endfor
call setqflist(qflist)
endfunction
au QuickfixCmdPost make call QfMakeConv()
This piece of code is from :h QuickFixCmdPost-example
, many non-english-speaking people use it. setqflist
will cause the cursor of quickfix window rewind to the first line, it's innocuity in the old days, but very ugly with async jobs.
So, there is an option named 'g:asyncrun_auto' here to get errormaker to work.
see here
(this page is still editing in progress ...)