Skip to content

Command Line Tool

Linwei edited this page Feb 28, 2020 · 28 revisions

This plugin provides you an asyncrun.py script (in the bin folder) when you want to run tasks right in your shell

Setup

To use it, copy the files from bin to /usr/local/bin or ~/bin, or simpily add bin folder to your $PATH in bashrc.

Usage

Then, in any child directories of your project, just type:

$ asynctask project-build

You don't have to jump back to your project root manually, because profile-build has a cwd=<root>.

Command

$ asynctask <taskname> [path]

Run the given task with the path, the path can be either a file name or a directory. It is used to extract macros like $(VIM_FILENAME) or $(VIM_ROOT), if path is omitted, current working directory will be used:

$ asynctask project-build .
$ asynctask project-build

The two commands works exactly the same way. The two below are also equivalent:

$ asynctask project-build ../project2
$ cd ../project2 && asynctask project-build && cd -

More examples:

# run with a file name, for tasks containing $(VIM_FILENAME), $(VIM_FILEPATH) ...
$ asynctask file-build hello.c

# execute the file
$ asynctask file-run hello.c

# run with a path, when the path is omitted, current cwd is used.
$ asynctask project-build ../project2

# build with "release" profile
$ asynctask -profile=release project-build

# run with interactive mode
$ asynctask -i

# use fzf to select tasks
$ asynctask -f

alias asynctask -f to task and use fzf for interactive mode:

Configurate

The config file locates in ~/.config/asynctask/asynctask.ini:

[default]
# comma separated list for additional global configs
extra_config=~/.vim/tasks.ini
root_marker=.git,.svn,.root,.project,.hg
cfg_name=.tasks
system=win32

[filetype]
asm=*.asm,*.s,*.S
bash=*.bash
c=*.[cChH],.[cChH].in
cmake=CMakeLists.txt
cpp=*.[cChH]pp,*.hh,*.[ch]xx,*.cc,*.cc.in,*.cpp.in,*.hh.in,*.cxx.in
cs=*.cs
dosini=*.ini
erlang=*.erl,*.hrl
fish=*.fish
go=*.go
haskell=*.hs
html=*.html,*.htm
java=*.java,*.jsp,*.jspx
javascript=*.js
json=*.json
kotlin=*.kt,*.kts
lua=*.lua
make=*.mk,*.mak,[Mm]akefile,[Gg][Nn][Uu]makefile,[Mm]akefile.in
markdown=*.md,*.markdown,*.mdown,*.mkdn
perl=*.pl
php=*.php,*.php4,*.php5
ps1=*.ps1
python=*.py,*.pyw
ruby=*.rb
rust=*.rs
scala=*.scala
sh=*.sh
swift=*.swift
text=*.txt
vim=*.vim
yaml=*.yaml,*.yml
zsh=*.zsh

You don't have to create this file, if you don't want to change the above default value.

Clone this wiki locally