Skip to content
Edit this page

Running and building

CodeArt runs your project's tasks from the editor with overseer.nvim: build it, start it, or run any script your project already defines. overseer loads only when you press a <leader>R key or run :CodeArtRun / :CodeArtBuild, so it costs nothing at startup.

Tests are separate: they stay on <leader>T and :CodeArtTest (see Testing).

Quick start

  1. Open a file in your project (or :cd into it).
  2. Press <leader>Rb to build. CodeArt picks the build task (for example make all, cmake build, npm run build, cargo build, dotnet build or go build ./...); when there are several, it asks which one. In a single file with no project around it, <leader>Rp offers to run that file (python main.py, nvim -l init.lua, build and run main.c, ...).
  3. The output opens in overseer's task list at the bottom. The cursor stays where it was.
  4. Press <leader>Rr to run the same task again.
Keys Command What it does
<leader>Rr :CodeArtRun Run the last task again, or pick one if nothing has run yet
<leader>Rp :CodeArtRun pick Pick a task from everything found in this project
<leader>Rb :CodeArtBuild Run the build task
<leader>Rl :CodeArtRun list Show or hide the task list (output, status, rerun and stop from there)
<leader>Rq :CodeArtRun quickfix Put the last task's output in the quickfix list (with 'errorformat')
<leader>RS :CodeArtRun stop Stop the last task if it is still running

:CodeArtRun last reruns the last task and says so when there is none. overseer's own commands (:OverseerRun, :OverseerToggle, :OverseerShell, ...) work too.

What is found

Tasks are looked up from the folder of the current file upwards (or from the working directory when no file is open).

overseer itself finds these:

Project file Tasks
Makefile Every make target (make all, make build, ...)
package.json Every script, run with npm, yarn, pnpm or bun (whichever lock file the project has)
Cargo.toml cargo build, cargo run, cargo check, cargo test, cargo clippy, cargo clean, ...
Justfile, mise.toml, Taskfile.yml, Rakefile, mix.exs, composer.json, deno.json, tox.ini Their tasks
.vscode/tasks.json The tasks VS Code would run, with their problem matchers

Every language pack adds templates of its own (the pack's run field). They are offered whether or not the pack is in languages, and each shows only when its program is installed:

Pack Detected by Tasks
cpp CMakeLists.txt (the outermost one) cmake build (configures build/ first, with compile_commands.json for clangd), cmake configure, ctest, cmake clean
cpp a .c / .cpp file outside a CMake or Make project build and run <file> (cc / c++, or gcc / clang)
csharp *.sln, *.slnx, *.csproj dotnet build, dotnet run (next to a .csproj), dotnet test, dotnet clean
java pom.xml mvn compile, mvn package, mvn test, mvn clean (./mvnw when the project has it)
java settings.gradle(.kts), build.gradle(.kts), gradlew gradle build, gradle run, gradle test, gradle clean (./gradlew when the project has it)
java a .java file outside a Maven or Gradle project java <file>
python a .py file python <file>, with the project's .venv / venv (or $VIRTUAL_ENV), or uv run in a uv project
python uv.lock, requirements.txt, pyproject.toml / setup.py, manage.py uv sync, pip install -r requirements.txt, pip install -e ., manage.py runserver
go go.mod go build ./..., go run ., go test ./..., go vet ./...; go run <file> outside a module
rust a .rs file outside a Cargo project build and run <file> (rustc)
web a .js / .ts file; tsconfig.json node <file> (Node.js 22.18+ runs TypeScript too); tsc --noEmit when TypeScript is installed in the project
lua a .lua file; stylua.toml, .busted, *.rockspec nvim -l <file>, lua <file>; stylua --check ., busted, luarocks make
bash a shell script bash <file>, shellcheck <file>
docker Dockerfile; compose.yaml / docker-compose.yml docker build, hadolint Dockerfile; docker compose up, docker compose down
markdown mkdocs.yml or zensical.toml; a .md file mkdocs build, mkdocs serve (only with mkdocs.yml); zensical build, zensical serve; pandoc <file> to HTML
toml a .toml file; taplo.toml taplo check <file>; taplo fmt --check
yaml a .yaml file; .github/workflows/ yamllint <file>; actionlint
sql a .sql file sqruff lint <file>, sqlite3 :memory: < <file>; psql -f <file> when $DATABASE_URL or $PGDATABASE is set
php a .php file; composer.json, phpunit.xml, phpstan.neon, artisan php <file>; composer install, phpunit and phpstan analyse (from vendor/bin), php artisan serve
zig build.zig; a .zig file zig build, zig build run, zig build test; zig run <file> (outside a build.zig project), zig test <file>
ruby a .rb file; Gemfile, .rspec, bin/rails ruby <file>; bundle install, rspec (with bundle exec in a Bundler project), rails server. Rakefile tasks come from overseer
kotlin a .kt / .kts file outside a Gradle or Maven project kotlinc <file> (compiles and runs; a .kts file runs as a script). Gradle and Maven projects get the java pack's tasks
terraform a folder with .tf files terraform init, terraform validate, terraform plan, terraform fmt -check -recursive (with tofu when only OpenTofu is installed)
powershell a .ps1 file; a *.Tests.ps1 file pwsh <file>; Invoke-Pester (Pester 5)
vue package.json with vue-tsc installed vue-tsc --noEmit. The project's scripts (vite, vite build, ...) come from package.json
dart pubspec.yaml; a .dart file outside a project dart pub get, dart run, dart test, dart analyze (the flutter ones when pubspec.yaml uses Flutter); dart run <file>
tex a .tex file; a .typ file latexmk -pdf <file>, latexmk -c (tectonic <file> without latexmk); typst compile <file>, typst watch <file> (with the typst CLI)
nix flake.nix; default.nix; a .nix file nix build, nix run, nix flake check, nix flake update; nix-build (without a flake); nix eval <file>
elixir a .exs file, or a .ex file outside a Mix project elixir <file>. Mix projects get every mix task (mix test, mix phx.server, ...) from overseer

A file task remembers its file: <leader>Rr reruns it even after you switch to another buffer.

Templates in your own packs

A pack in user/languages/ can bring templates too:

-- user/languages/ocaml.lua
return {
  description = "OCaml",
  filetypes = { "ocaml" },
  run = {
    { name = "dune build", root = { "dune-project" }, cmd = { "dune", "build" }, tags = { "BUILD" } },
    { name = "ocaml $FILE", filetypes = { "ocaml" }, cmd = { "ocaml", "$FILE" }, tags = { "RUN" } },
  },
}
Field What it does
name Shown in the list; $FILE becomes the file name
cmd A list (run without a shell), a string (run by the shell) or function(ctx) returning either. $FILE is the current file, $STEM that path without its extension, $ROOT the project folder and $DIRNAME its name
root File or folder names that mark the project, looked up from the current file (globs such as *.csproj work), or function(ctx) returning the folder. Without it the task is for the current file
outermost Use the outermost match of root (as CMake does)
filetypes Only for these filetypes
when function(ctx) returning false hides the task
needs Programs that must be installed (default: the first word of a list cmd)
cwd "root" (the default with root) or "file" (the file's folder)
tags overseer tags; BUILD is what :CodeArtBuild runs

ctx has file, filetype, dir, root and is_win. require("codeart.languages.util") has helpers the built-in packs use: python(root), wrapper(root, "gradlew", "gradle"), build_and_run(compiler, file) and chain({ cmd1, cmd2, ... }).

To run one command after another, return chain from cmd rather than writing a && b: it quotes each argument for the shell that runs tasks and stops at the first failure, including in Windows PowerShell 5.1, which has no && (a; if ($?) { b }). On Windows, CodeArt runs tasks in pwsh when it is installed, otherwise in Windows PowerShell.

cmd = function(ctx)
  return require("codeart.languages.util").chain({ { "dune", "build" }, { "dune", "exec", "./main.exe" } })
end,

Which task is the build

:CodeArtBuild uses the tasks tagged as builds (cargo build, cmake build, dotnet build, mvn compile, gradle build, go build, uv sync, pip install -r requirements.txt, mkdocs build, zensical build, VS Code tasks in the build group). Without those it looks for make all, make build, then any task with build in its name. If nothing matches it says so; <leader>Rp still lists every task.

A project with nothing to run

If nothing is found, :CodeArtRun says "No tasks to run" instead of doing nothing. Add a Makefile or a package.json script, write a .vscode/tasks.json, or add a template to a pack of your own (above).

Options

overseer options go in config.overseer and are merged over CodeArt's (the task list opens at the bottom):

M.config = {
  overseer = {
    task_list = { direction = "right" },
  },
}

To turn running off completely (no <leader>R keys, no :CodeArtRun):

M.disable_plugins = {
  overseer = true,
}

:CodeArtSetup can turn it on or off too (in the optional plugins question).