Verified Commit 6c6fe092 authored by Marco Kellershoff's avatar Marco Kellershoff 🤸

Make Taskfile run synchronous by default

parent 8a9e84e1
......@@ -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>)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment