-
Notifications
You must be signed in to change notification settings - Fork 116
FAQ
Can asyncrun.vim trigger an autocommand QuickFixCmdPost to get some plugin (like errormaker) processing the content in quickfix ?
Sure you can use either g:asyncrun_exit or -post or g:asyncrun_auto in your case without modifing any code in asyncrun.vim.
setup global callback on job finished:
let g:asyncrun_exit = "silent doautocmd QuickFixCmdPost make"setup local callback on each command:
:AsyncRun -post=silent\ doautocmd\ QuickFixCmdPost\ make @ makeThere is a new option in the latest asyncrun (1.3.5) to enable asyncrun trigger QuickFixCmdPre/QuickFixCmdPost
:let g:asyncrun_auto = "make"After that, asyncrun can cooperate with errormaker now.
The '%' is expanded and escaped by vim itself on the command line, and if the buffer is named 'hello world', % will be escaped as 'hello\ world' by vim. The backslash here is the escaping character, and is okay on all the unix systems, but unfortunately, on windows cmd.exe assumes it as a path seperator.
Here is another accurate form on both windows and unix:
:AsyncRun gcc "$(VIM_FILEPATH)" -o "$(VIM_FILEDIR)/$(VIM_FILENAME)"Macros wrapped by $(...) are expanded by asyncrun with a string replacing.
Any string starting with a '%', '<' or '#' in vim's command line will be expanded and escaped by vim (see: ":help filename-modifiers"). Only "$(...)" are handled by asyncrun.
$(VIM_FILEPATH) is more accurate than %:p on both windows and unix when there are spaces in the filename.
But most of time, there is no space in a filename and a lot of people don't use windows in their everyday work.
In this circumstance, you can use "%..." for short.
Because asyncrun uses caddexpr to populate the quickfix list. And caddexpr only works with global value of the errorformat. There is an option named g:asyncrun_local which can be set to non-zero to get asyncrun to temporarily modify &g:errorformat to &l:errorformat.
Consider to the performance problems (especially for some crazy stl error outputs), g:asyncrun_local is set to zero by default. You can turn it on if you are using local errorformat. See issue 16.
Use autocmd AsyncRunStart with asyncrun#quickfix_toggle in your vimrc:
augroup MyGroup
autocmd User AsyncRunStart call asyncrun#quickfix_toggle(8, 1)
augroup ENDHas your errorformat been modified by some plugins like vim-go or polyglot ?
These plugins will set errorformat to filter out non-error messages in quickfix.
see: https://github.com/skywind3000/asyncrun.vim/issues/30 https://github.com/skywind3000/asyncrun.vim/issues/58