From a5e8bbeb9d79d905a193e95a39acd29bc37e6c66 Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Wed, 16 Sep 2026 08:47:13 +0200 Subject: Updated dotfiles --- neovim/.config/nvim/lua/config/project_run.lua | 151 +++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 neovim/.config/nvim/lua/config/project_run.lua (limited to 'neovim/.config/nvim/lua/config/project_run.lua') diff --git a/neovim/.config/nvim/lua/config/project_run.lua b/neovim/.config/nvim/lua/config/project_run.lua new file mode 100644 index 0000000..40c1795 --- /dev/null +++ b/neovim/.config/nvim/lua/config/project_run.lua @@ -0,0 +1,151 @@ +-- Single-source-of-truth helper for project-local run/debug configs, meant +-- to be called once per config from a project's `.nvim.lua` (requires +-- `opt.exrc` - see options.lua - and trusting the file once via +-- `:help :trust`). One call registers both an overseer run task and a +-- matching nvim-dap debug config, so a project states its command once +-- instead of repeating it across a separate run-file and debug-file. +-- +-- Example .nvim.lua (script invocation): +-- require("config.project_run").python({ +-- name = "Run app", +-- program = vim.fn.getcwd() .. "/main.py", +-- args = { "--flag" }, -- optional, shared by both run and debug +-- }) +-- +-- Example .nvim.lua (module invocation, `python -m `): +-- require("config.project_run").python({ +-- name = "Run app", +-- module = "fastapi", +-- args = { "dev", "app" }, +-- }) +-- +-- This shows "Run app" in the rr picker (plain execution) and in +-- the dc picker (same script/module, under debugpy, breakpoints +-- included). If /.venv exists, both get VIRTUAL_ENV/PATH pointed at +-- it, same as `uv run` (or `source .venv/bin/activate`) would - and the +-- debug config additionally gets pythonPath set to that venv's interpreter, +-- since debugpy runs the script with the literal interpreter it's told +-- rather than resolving `python3` via PATH. +-- +-- Example .nvim.lua (Node, script invocation): +-- require("config.project_run").node({ +-- name = "Run app", +-- program = vim.fn.getcwd() .. "/index.js", +-- args = { "--flag" }, -- optional, shared by both run and debug +-- }) +-- +-- Example .nvim.lua (Node, `npm run