-
Notifications
You must be signed in to change notification settings - Fork 116
Multiple run mode
Linwei edited this page Jan 9, 2020
·
22 revisions
There is a -mode=? option can allow you specify how to run your command.
| mode | description |
|---|---|
| async | default behavior, run async command and output to quickfix window |
| bang | same as !
|
| os | (windows only) open a new cmd.exe window and run your command in it |
| term | open a reusable builtin terminal window and run your command |
You may ask, why there is still a -mode=bang since you can use :!command directly. The reason is asyncrun can setup environment variables and can help you change directory (-cwd) before execution:
:AsyncRun -mode=bang -cwd=<root> gcc -c "$(VIM_FILENAME)"is different with:
:!gcc abc.c -o abcWhen you are using AsyncRun -mode=bang, environment variables (eg $VIM_FILEDIR, $VIM_ROOT and $VIM_SVRNAME ..etc)
can be setup and you can indicate -cwd=? to indicate where to run the command (eg, in current project root).
Sometimes it is helpful than directly using !.
If you are using GVim on Windows. The -mode=os option can use a new cmd.exe window: