-
Notifications
You must be signed in to change notification settings - Fork 31
Task Config
Linwei edited this page Dec 31, 2021
·
24 revisions
A basic task sample looks like this:
# define a new task named "file-build"
[file-build]
# shell command, use quotation for filenames containing spaces
# check ":AsyncTaskMacro" to see available macros
command=gcc "$(VIM_FILEPATH)" -o "$(VIM_FILEDIR)/$(VIM_FILENOEXT)"
# working directory, can change to $(VIM_ROOT) for project root
cwd=$(VIM_FILEDIR)
# output mode, can be one of quickfix and terminal
# - quickfix: output to quickfix window
# - terminal: run the command in the internal terminal
output=quickfix
# this is for output=quickfix only
# if it is omitted, vim's current errorformat will be used.
errorformat=%f:%l:%m
# save file before execute
save=1
Here is a list of all available options in the task configuration:
Name | Required | Description |
---|---|---|
command |
yes | shell command, or vimscript (starting with : ) |
cwd |
no | working directory, vim's working directory will be used when absent |
output |
no |
quickfix or terminal
|
pos |
no | terminal position or the name of a runner. if not provided, g:asynctasks_term_pos will be used. use tab , TAB , bottom , top , left , right , and external for internal terminal position, or gnome , iterm , floaterm , and tmux for external runners. see extra runner
|
errorformat |
no | error matching rules in the quickfix window, only works for output=quickfix . the current vim option &errorformat will be used if not provided |
save |
no | set to 1 to save modified buffers before task start |
option |
no | arbitrary string to pass to the runner |
focus |
no | set to 0 to prevent changing focus to the task terminal |
close |
no | set to 1 to close the task terminal when task is finished |
program |
no | command modifier |
notify |
no | set to true to notify a message when task is finished, and many other usage, see here
|
strip |
no | set to 1 to trim empty lines and header+footer in the quickfix window (quickfix only) |
scroll |
no | set to 0 to forbid quickfix scrolling (quickfix only) |
encoding |
no | task stdin/stdout encoding (quickfix only) |
once |
no | set to 1 to buffer output and flush when job is finished, useful when there are multi-line patterns in your errorformat (quickfix only) |