A Neovim plugin for working w/ Taskfiles
vim.pack
Requires Neovim v0.12+
vim.pack.add({
--- .....
{
source = 's0cks/taskfile.nvim',
setup = function()
require('taskfile').setup({
---@see lua/taskfile/config.lua
})
end
},
--- .....
})Lazy
{
's0cks/taskfile.nvim',
opts = {},
config = function(_, opts)
require('taskfile').setup(opts)
end,
}Here is the default config:
---@class taskfile.Opts
---@field notify? fun(msg, level, opts) The notify function
{
notify = vim.notify,
}See lua/taskfile/config.lua for an up-to-date version
- taskfile-lsp --- A language-server (LSP) for working w/ Taskfiles
Optional / Highly Recommended
This plugin creates the following commands:
| Command | Description |
|---|---|
:Task |
Spawn vim.ui.select and run the selected task |
This plugin creates the following filetypes:
| Filetype | Source | Description |
|---|---|---|
yaml.taskfile |
Filenames: - Taskfile.{yaml,yml} |
A filetype for taskfiles w/ YAML filetype combinator |
---@class taskfile.Task
---@field name string The name of the task
---@field desc string The description of the task
---@class taskfile.SelectOpts : vim.ui.select.Opts
---@class taskfile.TaskJobOpts
---@field notify? fun(msg, level, opts) The notify function
---@field on_finished? fun() The callback to invoke when finishedYou can get a list of tasks from the Taskfile:
local tasks = require('taskfile').list_tasks()--- List the available tasks
---@return taskfile.Task[]
function M.list_tasks() endYou can open vim.ui.select for a list of tasks using:
local taskfile = require('taskfile')
local tasks = taskfile.list_tasks()
taskfile.select_task(tasks, function(task)
--- do something
end)--- Open a select prompt for a list of tasks
---@param tasks taskfile.Task[] The tasks to select from
---@param on_choice fun(task: taskfile.Task) The callback when a choice is selected
---@param opts? taskfile.SelectOpts The opts to use
function M.select_task(tasks, on_choice, opts) endYou can start a job for a task by doing:
require('taskfile').start_task_job('default')--- Start a job running the task
---@param task string The name of the task to run
---@param opts? taskfile.TaskJobOpts
function M.start_task_job(task, opts) end- The Task team --- For task 🫶
See LICENSE
