{"id":13412636,"url":"https://github.com/Shatur/neovim-tasks","last_synced_at":"2025-03-14T18:31:54.965Z","repository":{"id":63962279,"uuid":"535027240","full_name":"Shatur/neovim-tasks","owner":"Shatur","description":"A statefull task manager focused on integration with build systems.","archived":false,"fork":false,"pushed_at":"2024-07-15T14:32:52.000Z","size":41,"stargazers_count":107,"open_issues_count":5,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-19T02:56:51.266Z","etag":null,"topics":["c","cargo","cmake","cpp","debug","quickfix","rust"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shatur.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-10T14:46:27.000Z","updated_at":"2024-09-12T14:39:23.000Z","dependencies_parsed_at":"2024-01-03T03:30:22.815Z","dependency_job_id":"b49da95c-e058-4a0e-b2ec-cc28ed7369e1","html_url":"https://github.com/Shatur/neovim-tasks","commit_stats":{"total_commits":22,"total_committers":8,"mean_commits":2.75,"dds":"0.40909090909090906","last_synced_commit":"99055e0a419c576646c0e9f0eb974c82add7c85d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shatur%2Fneovim-tasks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shatur%2Fneovim-tasks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shatur%2Fneovim-tasks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shatur%2Fneovim-tasks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shatur","download_url":"https://codeload.github.com/Shatur/neovim-tasks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243625157,"owners_count":20321245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cargo","cmake","cpp","debug","quickfix","rust"],"created_at":"2024-07-30T20:01:27.085Z","updated_at":"2025-03-14T18:31:54.957Z","avatar_url":"https://github.com/Shatur.png","language":"Lua","funding_links":[],"categories":["Code Runner","Lua"],"sub_categories":["Quickfix"],"readme":"# Neovim Tasks\n\nA Neovim plugin that provides a stateful task system focused on integration with build systems.\n\nTasks in this plugin are provided by modules that implement functionality for a specific build system. Modules can have custom parameters which user can set via `:Task set_module_param` (like current target or build type). Tasks consists of one or more commands and have `args` and `env` parameters to set arguments and environment variable respectively. All this settings are serializable and will be stored in configuration file in your project directory.\n\n## Dependencies\n\n- Necessary\n  - [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) for internal helpers.\n- Optional\n  - [nvim-dap](https://github.com/mfussenegger/nvim-dap) - for debugging.\n\n## Features\n\n- Output directly into quickfix for fast navigation.\n- Tasks provided by modules which can have custom parameters.\n- Modules are lazy loaded.\n- Module for a task name could be determined automatically based on its condition.\n- Tasks can run through debugger.\n- Tasks can be chained and react on the previous output.\n- Task and module parameters are serializable and specific to the current working directly.\n- Tasks arguments could be read from parameters and / or extended via additional temporary arguments passed to `:Task` command.\n\n## Available modules\n\n- [CMake](https://cmake.org) via [cmake-file-api](https://cmake.org/cmake/help/latest/manual/cmake-file-api.7.html#codemodel-version-2).\n- [Cargo](https://doc.rust-lang.org/cargo).\n- [GNU Make](https://www.gnu.org/software/make/)\n\nYou can also write [your own module](#modules-creation-and-configuration).\n\n## Commands\n\nUse the command `:Task` with one of the following arguments:\n\n| Argument(s)                              | Description                                                                  |\n| ---------------------------------------- | ---------------------------------------------------------------------------- |\n| `start \u003cmodule\u003e \u003ctask\u003e`                  | Starting a task from a module.                                               |\n| `set_module_param \u003cmodule\u003e \u003cparam\u003e`      | Set parameter for a module. All parameters are module-specific.              |\n| `set_task_param \u003cmodule\u003e \u003cparam\u003e \u003ctask\u003e` | Set parameter for a task from a module. The parameter can be `arg` or `env`. |\n| `cancel`                                 | Cancel currently running task.                                               |\n\nModules and tasks will be autocompleted.\n\nModule name can be `auto`, in which case the first module that satisfies the condition will be used.\n\n## Configuration\n\nTo configure the plugin, you can call `require('tasks').setup(values)`, where `values` is a dictionary with the parameters you want to override. Here are the defaults:\n\n```lua\nlocal Path = require('plenary.path')\nrequire('tasks').setup({\n  default_params = { -- Default module parameters with which `neovim.json` will be created.\n    cmake = {\n      cmd = 'cmake', -- CMake executable to use, can be changed using `:Task set_module_param cmake cmd`.\n      build_dir = tostring(Path:new('{cwd}', 'build', '{os}-{build_type}')), -- Build directory. The expressions `{cwd}`, `{os}` and `{build_type}` will be expanded with the corresponding text values. Could be a function that return the path to the build directory.\n      build_type = 'Debug', -- Build type, can be changed using `:Task set_module_param cmake build_type`.\n      dap_name = 'lldb', -- DAP configuration name from `require('dap').configurations`. If there is no such configuration, a new one with this name as `type` will be created.\n      args = { -- Task default arguments.\n        configure = { '-D', 'CMAKE_EXPORT_COMPILE_COMMANDS=1', '-G', 'Ninja' },\n      },\n    },\n  },\n  save_before_run = true, -- If true, all files will be saved before executing a task.\n  params_file = 'neovim.json', -- JSON file to store module and task parameters.\n  quickfix = {\n    pos = 'botright', -- Default quickfix position.\n    height = 12, -- Default height.\n  },\n  dap_open_command = function() return require('dap').repl.open() end, -- Command to run after starting DAP session. You can set it to `false` if you don't want to open anything or `require('dapui').open` if you are using https://github.com/rcarriga/nvim-dap-ui\n```\n\n## Usage examples\n\n### CMake\n\n1. Open a CMake project.\n2. Run `configuration` task using `:Task start cmake configure`.\n3. Select a target by specifying module parameter with `:Task set_module_param cmake target`. All module parameters are specific to modules. Since CMake can't run targets like Cargo, we introduced a parameter to select the same target for building (appropriate arguments will be passed to CMake automatically) and running.\n4. Optionally set arguments using `:Task set_task_param cmake run`.\n5. Build and run the project via `:Task start cmake run` or build and debug using `:Task start cmake debug`. You can pass additional arguments to these commands, which will be temporarily added to the arguments from the previous step.\n\n### Cargo\n\n1. Open a Cargo project.\n2. Optionally set arguments using `:Task set_task_param cargo run`.\n3. Optionally set global cargo arguments using `:Task set_task_param cargo global_cargo_args`.\n4. Build and run the project via `:Task start cargo run` or build and debug using `:Task start cargo debug`.\n\nCargo module doesn't have a `target` param which specific to CMake because `cargo run` automatically pick the binary. If there is multiple binaries, you can set which one you want to run using `--bin` or `--project` in step 2 as you do in CLI.\n\n### GNU Make\n\n1. Open a Make project.\n2. Run a Make target `\u003ctarget\u003e` with `:Task start make \u003ctarget\u003e`.\n\nTo override targets or add custom `make` options, configure the appropriate task:\n\n```lua\nrequire('tasks').setup({\n  default_params = {\n    ...\n    make = {\n      cmd = 'make',\n      args = {\n        all = { '-j10', 'all' },    -- :Task start make all   → make -j10 all\n        build = {},                 -- :Task start make build → make\n        nuke = { 'clean' },         -- :Task start make nuke  → make clean\n      },\n    },\n    ...\n  }\n})\n```\n\n\n## Modules creation and configuration\n\nTo create a module just put a lua file under `lua/tasks/module` in your configuration or submit your module as a PR. In this module you need to return a table with the following fields:\n\n```lua\n{\n  params = {\n    -- A table of parameter names. Possible values:\n    'parameter_name1', -- A string parameter, on setting user will be prompted with vim.ui.input.\n    parameter_name2 = { 'one', 'two' }, -- A table with possible values, on setting user will be prompted with vim.ui.select to pick one of these values.\n    parameter_name3 = func, -- A function that generates a string or a table.\n  }\n  condition = function() return Path:new('file'):exists() end -- A function that returns `true` if this module could be applied to this directory. Used when `auto` is used as module name.\n  tasks = {\n    -- A table of module tasks. Possible values:\n    task_name1 = {\n      -- Required parameters:\n      cmd = 'command' -- Command to execute.\n      -- Optional parameters:\n      cwd = 'directory' -- Command working directory. Default to current working directory.\n      after_success = callback -- A callback to execute on success.\n      dap_name = 'dap_name' -- A debug adapter name. If exists, the task will be launched through the adapter. Usually taken from a module parameter. Implies ignoring all streams below.\n      -- Disable a stream output to quickfix. If both are disabled, quickfix will not show up. If you want to capture output of a stream in a next task, you need to disable it.\n      ignore_stdout = true,\n      ignore_stderr = true,\n    },\n    task_name2 = func1, -- A function that returns a table as above. Accepts configuration for this module and previous job.\n    task_name3 = { func2, func3 }, -- A list of functions as above. Tasks will be executed in chain.\n  }\n}\n```\n\nFor a more complex example take a look at [cargo.lua](lua/tasks/module/cargo.lua).\n\nYou can also edit existing modules in right in your config. Just import a module using `require('tasks.module.module_name')` and add/remove/modify any fields from the above.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FShatur%2Fneovim-tasks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FShatur%2Fneovim-tasks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FShatur%2Fneovim-tasks/lists"}