...
 
Commits (2)
......@@ -13,12 +13,11 @@ You can run the `build` task of the Taskfile like so:
You can also autocomplete tasks pressing `<tab>`, or `<tab><tab>`.
### Verbose
### Asynchronous
If you like to see the output of the tasks, you can set the plugin to be more
verbose with `TaskVerbose 1`. This will spawn a term for every task executed.
If you want to disable the verbosity again, simply run `TaskVerbose 0`.
Taskfile tasks are run synchronous by default.
You can set `g:TaskfileAsynchronous=1` in your `nvim/init.vim`/`.vimrc`
to enable asynchronous mode.
[Taskfile]: https://git.superevilmegaco.com/bash/Taskfile
......@@ -15,27 +15,14 @@ Task *:Task*
Run tasks defined in the Taskfile.
`:Task <tab><tab>`
TaskVerbose *:TaskVerbose*
After setting verbose mode to 1 each task is executed in a
Vim term.
`:TaskVerbose 1|0`
MAPPINGS *Taskfile-mappings*
There are no mappings registered by the plugin.
You need to map it according to your preference.
*Taskfile#Run()*
Runs the task passed as argument to the function.
*Taskfile#Verbose()*
Sets output to verbose. Each task is executed in a Vim term.
`:call Taskfile#Verbose(1)`
To disable verbose mode, just call the function with 0.
`:call Taskfile#Verbose(0)`
Runs the task passed as argument to the function.
ABOUT *Taskfile-about*
......
......@@ -4,7 +4,6 @@ endif
let g:loaded_Taskfile = 1
let s:PluginName = "Taskfile.nvim"
let s:isVerbose = 0
let s:taskList = [""]
let s:TaskfileWindow = 0
......@@ -16,14 +15,6 @@ function! s:FileExists(filepath)
endif
endfunction
function! Taskfile#Verbose(enable)
if a:enable == 1
let s:isVerbose = 1
else
let s:isVerbose = 0
endif
endfunction
function! Taskfile#Run(...)
let filepath = s:GetTaskfileAbsoluteFilepath()
if s:FileExists(filepath) == 0
......@@ -107,26 +98,22 @@ endfunction
function! s:ExecExternalCommand(command)
if has("nvim") == 1
if s:isVerbose == 0
if exists("g:TaskfileAsynchronous")
call jobstart(["bash", "-c", a:command])
else
let winnr = winnr()
botright new | call termopen(["bash", "-c", a:command], extend({"shell": s:PluginName}, s:termEventCallbacks))
let s:TaskfileWindow = winnr()
execute "normal! G"
execute winnr . "wincmd w"
execute "!" . a:command
endif
elseif v:version >= 800
if s:isVerbose == 0
if exists("g:TaskfileAsynchronous")
call job_start("bash -c " . a:command)
else
new termopen(["bash", "-c", a:command], extend({"shell": s:PluginName}, s:termEventCallbacks))
execute "!" . a:command
endif
else
if s:isVerbose == 1
execute "!" . a:command
else
if exists("g:TaskfileAsynchronous")
silent execute "!" . a:command
else
execute "!" . a:command
endif
endif
endfunction
......@@ -146,5 +133,4 @@ function! s:GetCurrentFile()
endfunction
command! -bang -complete=customlist,s:taskListCompletion -nargs=* Task call Taskfile#Run(<f-args>)
command! -nargs=1 TaskVerbose call Taskfile#Verbose(<f-args>)