{"id":16589380,"url":"https://github.com/shatur/neovim-tasks","last_synced_at":"2025-09-11T08:32:25.648Z","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":232629391,"owners_count":18552835,"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-10-11T23:08:36.365Z","updated_at":"2025-09-11T08:32:25.636Z","avatar_url":"https://github.com/Shatur.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"Neovim Tasks\n===============\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- [Bazel](https://bazel.build)\n- [GNU Make](https://www.gnu.org/software/make/)\n- [Zig](https://ziglang.org/learn/build-system/)\n- [NPM](https://www.npmjs.com/)\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_type = 'Debug', -- Build type, can be changed using `:Task set_module_param cmake build_type`.\n        build_kit = 'default', -- default build kit, can be changed using `:Task set_module_param cmake build_kit`.\n        dap_name = 'codelldb', -- 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        build_dir = tostring(Path:new('{cwd}', 'build', '{build_kit}', '{build_type}')), -- Build directory. The expressions `{cwd}`, `{build_kit}` and `{build_type}` will be expanded with the corresponding text values. Could be a function that return the path to the build directory.\n        cmake_kits_file = nil, -- set path to JSON file containing cmake kits\n        cmake_build_types_file = nil, -- set path to JSON file containing cmake kits\n        clangd_cmdline = {\n          'clangd',\n          '--background-index',\n          '--clang-tidy',\n          '--header-insertion=never',\n          '--completion-style=detailed',\n          '--offset-encoding=utf-8',\n          '-j=4',\n        }, -- command line for invoking clangd - this array will be extended with --compile-commands-dir and --query-driver after each cmake configure with parameters inferred from build_kit, build_type and build_dir\n        ignore_presets = false, -- if true, cmake presets will not be used, build_kit and build_type will be used instead even if CMakePresets.json or CMakeUserPresets.json files are present in the project root.\n        restart_clangd_after_configure = true, -- if true, clangd will be restarted after each cmake configure with updated compile_commands.json file and --query-driver parameters mattching current cmake build_kit and build_type or build_preset.\n      },\n      bazel = {\n        cmd = 'bazel',\n        dap_name = 'codelldb',\n      },\n      zig = {\n        cmd = 'zig', -- zig command which will be invoked\n        dap_name = 'codelldb', -- 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        build_type = 'Debug', -- build type, can be changed using `:Task set_module_param zig build_type`\n        build_step = 'install', -- build step, cah be changed using `:Task set_module_param zig build_step`\n      },\n      cargo = {\n        dap_name = 'codelldb', -- 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      },\n      npm = {\n        cmd = 'npm', -- npm command which will be invoked. If using yarn or pnpm, change here.\n        working_directory = vim.loop.cwd(), -- working directory in which NPM will be invoked\n      },\n      make = {\n        cmd = 'make', -- make command which will be invoked\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    save_before_run = true,\n    params_file = 'neovim.json',\n    quickfix = {\n      pos = 'botright',\n      height = 12,\n      only_on_error = false,\n    },\n    dap_open_command = function() return require('dap').repl.open() end,\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### CMake build types\n\nYou can define your custom build types in a JSON file, path to which needs to be specified in the `default_params` object as described above. An example JSON file with CMake build types looks like this:\n\n```json\n{\n    \"debug\" : {\n        \"build_type\" : \"Debug\",\n        \"cmake_usr_args\" : {\n            \"MY_TREAT_WARNINGS_AS_ERRORS\": \"OFF\"\n        }\n    },\n    \"dev-release\": {\n        \"build_type\" : \"RelWithDebInfo\",\n        \"cmake_usr_args\": {\n            \"MY_TREAT_WARNINGS_AS_ERRORS\": \"ON\"\n        }\n    },\n    \"release\": {\n        \"build_type\" : \"Release\",\n        \"cmake_usr_args\": {\n            \"MY_TREAT_WARNINGS_AS_ERRORS\": \"ON\"\n        }\n    }\n}\n```\n\nThe structure of the JSON is in the form:\n\n```json\n{\n    \"build_type_name\": {\n        \"build_type\": \"this will be passed to -DCMAKE_BUILD_TYPE\",\n        \"cmake_usr_args\": { // optional, will be passed to cmake configure whenever build_type_name is active\n            \"cmake_variable1\": \"value1\",\n            \"cmake_variable2\": \"value2\",\n            ...\n        }\n    },\n    ...\n}\n```\n\nThis allows for custom cmake user arguments for each build type that will always be applied, regardless of selected CMake kit.\n\n### Cmake build kits\n\nYou can define your custom build kits (or toolchains) in a JSON file, path to which needs to be specified in the `default_params` object as described above. An example JSON file with CMake kits looks like this:\n\n```json\n{\n    \"xcode-clang\": {\n        \"compilers\": {\n            \"C\": \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc\",\n            \"CXX\": \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++\"\n        },\n        \"query_driver\" : \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++\",\n        \"generator\": \"Xcode\",\n        \"build_type_aware\": false\n    },\n    \"clang\": {\n        \"compilers\": {\n            \"C\": \"/usr/bin/clang\",\n            \"CXX\": \"/usr/bin/clang++\"\n        },\n        \"query_driver\" : \"/usr/bin/clang++\",\n        \"generator\": \"Ninja\"\n    },\n    \"clang-xcode-13.4.1\": {\n        \"compilers\": {\n            \"C\": \"/usr/bin/clang\",\n            \"CXX\": \"/usr/bin/clang++\"\n        },\n        \"query_driver\" : \"/usr/bin/clang++\",\n        \"environment_variables\": {\n            \"DEVELOPER_DIR\": \"/Applications/xcode-versions/Xcode-13.4.1.app/Contents/Developer\"\n        },\n        \"generator\": \"Ninja\"\n    },\n    \"emscripten-3.1.17\": {\n        \"toolchain_file\": \"~/.conan/data/emsdk_installer/3.1.17/microblink/stable/package/3c9d8fb1b383ce27cf8b0942dcbdbb6add8cbee9/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake\",\n        \"environment_variables\": {\n            \"EM_CONFIG\": \"/Users/dodo/.conan/data/emsdk_installer/3.1.17/microblink/stable/package/3c9d8fb1b383ce27cf8b0942dcbdbb6add8cbee9/.emscripten\",\n            \"EM_CACHE\": \"/Users/dodo/.conan/data/emsdk_installer/3.1.17/microblink/stable/package/3c9d8fb1b383ce27cf8b0942dcbdbb6add8cbee9/.emscripten_cache\"\n        },\n        \"cmake_usr_args\": {\n            \"MY_EMSCRIPTEN_EMRUN_BROWSER\": \"chrome\",\n            \"MY_EMSCRIPTEN_EMRUN_SILENCE_TIMEOUT\": \"300\",\n            \"MY_EMSCRIPTEN_EMRUN_SERVE_AFTER_CLOSE\": \"ON\",\n            \"MY_EMSCRIPTEN_EMRUN_BROWSER_ARGS\": \"--remote-debugging-port=9622\"\n        },\n        \"query_driver\" : \"~/.conan/data/emsdk_installer/3.1.17/microblink/stable/package/3c9d8fb1b383ce27cf8b0942dcbdbb6add8cbee9/upstream/emscripten/em++\",\n        \"generator\": \"Ninja\"\n    }\n}\n```\n\nThe structure of the JSON is in the form:\n\n```json\n{\n    \"build_kit_name\": {\n        \"compilers\": { // optional, if provided it will pass -DCMAKE_C_COMPILER and -DCMAKE_CXX_COMPILER to cmake during configuration, not needed when toolchain_file is provided or default compiler is used\n            \"C\": \"/path/to/c/compiler/to/be/used\",\n            \"CXX\": \"/path/to/c++/compiler/to/be/used\",\n        },\n        \"toolchain_file\": \"/path/to/cmake/toolchain/file\", // also optional, if provided, this will be passed to -DCMAKE_TOOLCHAIN_FILE\n        \"environment_variables\": { // optional, if provided, given environment variables will be set for every invocation of any cmake task\n            \"VAR1\": \"value1\",\n            \"VAR2\": \"value2\",\n            ...\n        },\n        \"cmake_usr_args\": { // optional, will be passed to cmake configure whenever build_kit_name is active\n            \"cmake_variable1\": \"value1\",\n            \"cmake_variable2\": \"value2\",\n            ...\n        },\n        \"query_driver\": \"/path/to/query_driver/compiler\", // optional, if provied, it will be passed as --query-driver` parameter to clangd when build_kit_name is active\n        \"generator\": \"cmake-generator\", // will be passed as -G option to cmake. If not provided, Ninja will be used. Keep in mind that not all generators support creating compile_commands.json file, which is needed for clangd to work. However, you can still use those generators for quickly creating CMake build directories (e.g. for Xcode)\n        \"build_type_aware\": true|false, // optional, indicates whether generator is aware of CMAKE_BUILD_TYPE. For example, IDE generators need to have this set to false to prevent invoking cmake with -DCMAKE_BUILD_TYPE=active_build_type\n    },\n    ...\n}\n```\n\n### Tasks\n\nCMake with Kits task module will generate following tasks:\n\n- `configure` — invokes cmake with parameters for active `build_kit` and `build_type`, or active `configure_preset` if presets are available\n- `configureDebug` - same as `configure`, but starts the CMake debugging session\n- `build` — builds the currenly selected target\n- `build_all` — builds all targets\n- `build_current_file` — builds target associated with now opened source file (Ninja generator only)\n- `run` — builds and then runs the selected target\n- `debug` — builds and then starts `nvim-dap` debug session for the selected target\n- `clean` — cleans the build directory\n- `ctest` — invokes `ctest`\n- `purge` — deletes the cmake binary directory (unix only)\n- `reconfigure` — equivalent to `purge` + `configure`\n\n\n### More CMake examples\n\n#### Example mappings\n\nHere is convenient Lua code for configuring mapping for tasks generated by this plugin:\n\n```lua\nvim.keymap.set( \"n\", \"\u003cleader\u003ecC\", [[:Task start cmake configure\u003ccr\u003e]], { silent = true } )\nvim.keymap.set( \"n\", \"\u003cleader\u003ecD\", [[:Task start cmake configureDebug\u003ccr\u003e]], { silent = true } )\nvim.keymap.set( \"n\", \"\u003cleader\u003ecP\", [[:Task start cmake reconfigure\u003ccr\u003e]], { silent = true } )\nvim.keymap.set( \"n\", \"\u003cleader\u003ecT\", [[:Task start cmake ctest\u003ccr\u003e]], { silent = true } )\nvim.keymap.set( \"n\", \"\u003cleader\u003ecK\", [[:Task start cmake clean\u003ccr\u003e]], { silent = true } )\nvim.keymap.set( \"n\", \"\u003cleader\u003ect\", [[:Task set_module_param cmake target\u003ccr\u003e]], { silent = true } )\nvim.keymap.set( \"n\", \"\u003cC-c\u003e\", [[:Task cancel\u003ccr\u003e]], { silent = true } )\nvim.keymap.set( \"n\", \"\u003cleader\u003ecr\", [[:Task start cmake run\u003ccr\u003e]], { silent = true } )\nvim.keymap.set( \"n\", \"\u003cF7\u003e\", [[:Task start cmake debug\u003ccr\u003e]], { silent = true } )\nvim.keymap.set( \"n\", \"\u003cleader\u003ecb\", [[:Task start cmake build\u003ccr\u003e]], { silent = true } )\nvim.keymap.set( \"n\", \"\u003cleader\u003ecB\", [[:Task start cmake build_all\u003ccr\u003e]], { silent = true } )\n\n-- open ccmake in embedded terminal\nlocal function openCCMake()\n    local build_dir = tostring( require( 'tasks.cmake_utils.cmake_utils' ).getBuildDir() )\n    vim.cmd( [[bo sp term://ccmake ]] .. build_dir )\nend\nvim.keymap.set( \"n\", \"\u003cleader\u003ecc\", openCCMake, { silent = true } )\n\n-- if project is using presets, provide preset selection for both \u003cleader\u003ecv and \u003cleader\u003eck\n-- if not, provide build type (\u003cleader\u003ecv) and kit (\u003cleader\u003eck) selection\n\nlocal function selectPreset()\n    local availablePresets = cmake_presets.parse( 'buildPresets' )\n\n    vim.ui.select( availablePresets, { prompt = 'Select build preset' }, function( choice, idx )\n        if not idx then\n            return\n        end\n        local projectConfig = ProjectConfig:new()\n        if not projectConfig[ 'cmake' ] then\n            projectConfig[ 'cmake' ] = {}\n        end\n\n        projectConfig[ 'cmake' ][ 'build_preset' ] = choice\n\n        -- autoselect will invoke projectConfig:write()\n        cmake_utils.autoselectConfigurePresetFromCurrentBuildPreset( projectConfig )\n\n    end)\nend\n\nlocal function selectBuildKitOrPreset()\n    if cmake_utils.shouldUsePresets() then\n        selectPreset()\n    else\n        tasks.set_module_param( 'cmake', 'build_kit' )\n    end\nend\n\nvim.keymap.set( \"n\", \"\u003cleader\u003eck\", selectBuildKitOrPreset, { silent = true } )\n\nlocal function selectBuildTypeOrPreset()\n    if cmake_utils.shouldUsePresets() then\n        selectPreset()\n    else\n        tasks.set_module_param( 'cmake', 'build_type' )\n    end\nend\n\nvim.keymap.set( \"n\", \"\u003cleader\u003ecv\", selectBuildTypeOrPreset, { silent = true } )\n```\n\n#### Correct LSP `clangd` config on NeoVim startup\n\nTo correctly boot the `clangd` LSP on NeoVim startup, you can configure LSP to immediately use correct `clangd` arguments with following code:\n\n```lua\nvim.lsp.config('clangd', {\n    cmd = require( 'tasks.cmake_utils.cmake_utils' ).currentClangdArgs(),\n})\n```\n\n#### Active CMake kit, target and build type or preset in [lualine](https://github.com/nvim-lualine/lualine.nvim) status\n\n```lua\nlocal Path = require('plenary.path')\nlocal lualine = require( 'lualine' )\nlocal ProjectConfig = require( 'tasks.project_config' )\n\nlocal function cmakeStatus()\n    local cmake_config = ProjectConfig:new()[ 'cmake' ]\n    local cmakelists_dir = cmake_config.source_dir and cmake_config.source_dir or vim.loop.cwd()\n    if ( Path:new( cmakelists_dir ) / 'CMakeLists.txt' ):exists() then\n        local cmake_utils = require( 'tasks.cmake_utils.cmake_utils' )\n\n        if cmake_utils.shouldUsePresets( cmake_config ) then\n            local preset = cmake_config.build_preset or 'not selected'\n            local cmakeTarget = cmake_config.target and cmake_config.target or 'all'\n\n            return 'CMake preset: ' .. preset .. ', target: ' .. cmakeTarget\n        else\n            local cmakeBuildType = cmake_config.build_type or 'not selected'\n            local cmakeKit = cmake_config.build_kit or 'not selected'\n            local cmakeTarget = cmake_config.target or 'all'\n\n            return 'CMake variant: ' .. cmakeBuildType .. ', kit: ' .. cmakeKit .. ', target: ' .. cmakeTarget\n        end\n    else\n        return ''\n    end\nend\n\nlualine.setup({\n    sections = {\n        lualine_c = { { 'filename', path = 1 } },\n        lualine_x = { 'encoding', 'fileformat', 'filetype', cmakeStatus }\n    }\n})\n```\n\n## Bazel\n\n1. Open a Bazel project.\n2. Optionally set compilation mode with `:Task set_module_param bazel build_type`.\n3. Optionally set bazel target with `:Task set_module_param bazel target`.\n4. Optionally set target arguments using `:Task set_task_param bazel run args`.\n5. Optionally set other bazel arguments using `:Task set_module_param bazel bazel_args`.\n   - For example, you can set `--copt=\"-g\" --strip=never --spawn_strategy=local --disk_cache=false` to enable debugging on MacOS, regardless of the compilation mode.\n   - there is also `global_bazel_args` module parameter that will be added before any `bazel_args` to every bazel command. Use it to tweak the default bazel output.\n5. Build and run the project via `:Task start bazel run` or build and debug using `:Task start bazel debug`.\n\n### Clangd compile commands JSON generation\n\n#### Using bazel tools, such as [bazel-compile-commands-extractor](https://github.com/hedronvision/bazel-compile-commands-extractor)\n\nBazel does not natively support generating `compile_commands.json` file, which is required for `clangd` to work properly. However, you can use the [bazel-compile-commands-extractor](https://github.com/hedronvision/bazel-compile-commands-extractor) to create a Bazel target that will generate the `compile_commands.json` file for you. You can also define your own target to do that. Once you have the target, run `:Task set_module_param bazel compile_commands_refresh_target` to set the name of the target that will be invoked to refresh the `compile_commands.json` file. The default value is `@hedron_compile_commands//:refresh_all`.\n\nOnce the refresh target is configured, you can run `:Task start bazel refresh_compile_commands` to regenerate the `compile_commands.json` file. This will also restart the `clangd` language server to pick up the changes.\n\n#### Using [bazel-compile-commands tool](https://github.com/kiron1/bazel-compile-commands)\n\nAlternatively, if you don't want to pollute your Bazel workspace with special targets for extracting compile commands, you can use the [bazel-compile-commands](https://github.com/kiron1/bazel-compile-commands) tool. Follow the installation instructions in the tool's README. Once installed, you can define the `bazel_compile_commands_tool` module parameter to point to the executable of this tool. The default value is `bazel-compile-commands`. Additionally, set the `bazel_compile_commands_tool_args` module parameter to define any arguments that will be given to the tool. You can use the `%target%` placeholder to put a currently selected bazel target in this place. This may be useful if you want to avoid generating large `compile_commands.json` files that may clog your clangd process. After setting this parameter, you can run `:Task start bazel external_refresh_compile_commands` to regenerate the `compile_commands.json` file and restart the `clangd` language server. All bazel arguments set with `:Task set_module_param bazel bazel_args` will be passed to the tool as well, but every argument will be prefixed with `bazel_compile_commands_tool_bazel_prefix` module parameter, which defaults to `--bazelopt=`.\n\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## Zig\n\n### Quick start with a zig file\n\n1. Open zig file that contains `main`\n2. Run `:Task start zig run_file`\n3. To start debugging the file, run `:Task start zig debug_file`\n\n### Quick start with a project that contains `build.zig` file\n\n1. Open Zig project\n2. Select a build step with `:Task set_module_param zig build_step`.\n3. Select a build type with `:Task set_module_param zig build_type`\n4. Run selected build step with `:Task start zig build`\n\n### All available zig tasks\n\n- `build` - invokes `zig build` with step configured as `build_step` with build type configured as `build_type`\n- `clean` - deletes the `zig-out` folder (works only on Unix shells at the moment)\n- `clean_cache` - deletes the `.zig-cache` folder (works only on Unix shells at the moment)\n- `clean_all` - invokes forst `clean`, then `clean_cache`\n- `run_file` - invokes `zig run` for currently open buffer. Obeys `build_type`\n- `debug_file` - starts debugger for currently open buffer (effectively as `run_file`, but under debugger)\n- `test_file` - invokes `zig test` for currently open buffer. Obeys `build_type`.\n- `debug_test_file` -same as `test_file`, but under debugger\n- `run_current_test` - invokes `zig test` for currently open buffer with test filter set to a first test above current cursor location. If test filter cannot be calculated, all tests in current file are run (behavior same as `test_file`).\n- `debug_current_test` - same as `run_current_test`, but under debugger\n\n## NPM\n\n1. Open a NPM project\n2. Run `:Task start npm install`\n3. You can also run any NPM script using `:Task start npm run \u003cscript\u003e`\n\nFor example, imagine that your `package.json` contains lines like these:\n\n```json\n{\n    \"scripts\": {\n        \"clean\": \"rimraf build dist\",\n        \"lint\": \"eslint --ext ts -c .eslintrc.json src\",\n        \"start\": \"NODE_PATH=$(pwd)/node_modules node $(pwd)/../core/scripts/https-serve.js dist\",\n        \"rollup\": \"rollup -c rollup.config.js\",\n    }\n}\n```\n\nYou can map then those commands with code like this:\n\n```lua\nvim.keymap.set( \"n\", \"\u003cleader\u003eni\", [[:Task start npm install\u003ccr\u003e]] )\nvim.keymap.set( \"n\", \"\u003cleader\u003enl\", [[:Task start npm run lint\u003ccr\u003e]] )\nvim.keymap.set( \"n\", \"\u003cleader\u003enr\", [[:Task start npm run rollup\u003ccr\u003e]] )\nvim.keymap.set( \"n\", \"\u003cleader\u003ens\", [[:Task start npm run clean\u003ccr\u003e]] )\nvim.keymap.set( \"n\", \"\u003cleader\u003ens\", [[:Task start npm run start\u003ccr\u003e]] )\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"}