-
Notifications
You must be signed in to change notification settings - Fork 32
Command Line Tool
This plugin provides you an asynctask.py
script (in the bin
folder) when you want to run tasks right in your shell.
To use it, make a soft link to your ~/bin
(make sure it is in your $PATH
):
$ ln -s /path/to/asynctask ~/bin/
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 project-build
has a cwd=<root>
.
$ 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:
The config file locates in ~/.config/asynctask/asynctask.ini
, no need to create this file if you don't want to change the default values below:
[default]
# comma separated list for additional global configs
global_config=~/.vim/tasks.ini,~/.config/asynctask/tasks.ini
root_marker=.git,.svn,.root,.project,.hg
cfg_name=.tasks
system=win32
# file type detection, to match commands with filetypes and fill $(VIM_FILETYPE) field.
# in asynctasks.vim, vim did this for you, but in command line, we will detect ourself.
[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
....
text=*.txt
vim=*.vim
yaml=*.yaml,*.yml
zsh=*.zsh
This config is useful when you need change one or more options:
[default]
system=macos
global_config=~/.vim/tasks,~/.local/etc/tasks
cfg_name=.git/tasks.ini
[filetype]
# add a new filetype
actionscript=*.as,*.as3
Tasks can be for vim only or shell only, you can setup asynctasks.vim
and asynctask.py
to include different global task configurations, for example: ~/.config/asynctask/tasks.ini
is loaded by default in asynctask.py
but not in the asynctasks.vim
.
Have difficult to remember long commands ? tired to type repetitive commands ??
asynctask.py
would also be useful when you need a bash snippets manager:
See the sample task ini.