Skip to content

Command Specification

Linwei edited this page Dec 31, 2021 · 12 revisions

Command

:AsyncRun[!] [options] {cmd} ...

Common Options

Option Default Value Description
-mode=? "async" specify how to run the command as -mode=?, available modes are "async" (default), "bang" (with ! command) and "terminal" (in internal terminal), see running modes for details.
-cwd=? unset initial directory (use current directory if unset), for example use -cwd=<root> to run commands in project root directory, or -cwd=$(VIM_FILEDIR) to run commands in current buffer's parent directory.
-save=? 0 use -save=1 to save current file, -save=2 to save all modified files before executing.
-program=? unset set to make to use &makeprg, grep to use &grepprt and wsl to execute commands in WSL (windows 10), see command modifiers.
-post=? unset vimscript to exec after job finished, spaces must be escaped to '\ '

Quickfix Special Options

Option Default Value Description
-auto=? unset event name to trigger QuickFixCmdPre/QuickFixCmdPost [name] autocmd.
-raw unset use raw output if provided, and &errorformat will be ignored.
-strip unset remove the heading/trailing messages if provided (omit command and "[Finished in ...]" message).
-errorformat=? unset errorformat for error matching, if it is unprovided, use current &errorformat value. Beware that % needs to be escaped into \%.
-silent unset provide -silent to prevent open quickfix window (will override g:asyncrun_open temporarily)
-scroll=? unset set to 0 to prevent quickfix auto-scrolling
-once=? unset set to 1 to buffer output and flush when job is finished, useful when there are multi-line patterns in your errorformat
-encoding=? unset specify command encoding independently (overshadow g:asyncrun_encs)

Internal Terminal Options

Option Default Value Description
-pos=? "bottom" When using internal terminal with -mode=term, -pos is used to specify where to split the terminal window, it can be one of "tab", "curwin", "top", "bottom", "left", "right" and "external". And you can customize new runners and pass runner's name to -pos option.
-rows=num 0 When using a horizontal split terminal, this value represents the height of terminal window.
-cols=num 0 When using a vertical split terminal, this value represents the width of terminal window.
-focus=? 1 set to 0 to prevent focus changing when -mode=term
-hidden=? 0 set to 1 to setup bufhidden to hide for internal terminal
-listed 1 when using -mode=term, set to 0 to hide the terminal in the buffer list
-close unset when using -mode=term, close the terminal automatically when terminal process is finished

Runner Options

Option Default Value Description
-option=? empty arbitrary string can be used to pass additional information to runner, eg. :AsyncRun -option=xxx ...