aboutsummaryrefslogtreecommitdiffstats
path: root/neovim/.config/nvim/lua/plugins/overseer.lua
diff options
context:
space:
mode:
Diffstat (limited to 'neovim/.config/nvim/lua/plugins/overseer.lua')
-rw-r--r--neovim/.config/nvim/lua/plugins/overseer.lua57
1 files changed, 57 insertions, 0 deletions
diff --git a/neovim/.config/nvim/lua/plugins/overseer.lua b/neovim/.config/nvim/lua/plugins/overseer.lua
new file mode 100644
index 0000000..99d0f5f
--- /dev/null
+++ b/neovim/.config/nvim/lua/plugins/overseer.lua
@@ -0,0 +1,57 @@
1-- Run configurations (PyCharm-style "run this again"), language-agnostic:
2-- works for npm scripts, make, cargo, arbitrary shell commands, python
3-- scripts, etc, unlike DAP which is Python-only for now.
4return {
5 "stevearc/overseer.nvim",
6 -- Not left to lazy-load off `cmd`/`keys`: a project's .nvim.lua (see
7 -- lua/config/project_run.lua) needs `require("overseer")` to work
8 -- immediately when exrc sources it, which requires the plugin already
9 -- being on runtimepath rather than deferred until first use.
10 lazy = false,
11 keys = {
12 { "<leader>rr", "<cmd>OverseerRun<cr>", desc = "Run task" },
13 {
14 "<leader>rl",
15 function()
16 -- :OverseerRestartLast exists in current overseer.nvim versions; the
17 -- run_action fallback covers older/newer versions that lack it
18 -- rather than hard-failing the keymap.
19 if vim.fn.exists(":OverseerRestartLast") == 2 then
20 vim.cmd("OverseerRestartLast")
21 return
22 end
23 local overseer = require("overseer")
24 local tasks = overseer.list_tasks({ recent_first = true })
25 if vim.tbl_isempty(tasks) then
26 vim.notify("No previous task to rerun", vim.log.levels.WARN)
27 else
28 overseer.run_action(tasks[1], "restart")
29 end
30 end,
31 desc = "Rerun last task",
32 },
33 { "<leader>ro", "<cmd>OverseerToggle<cr>", desc = "Toggle task list/output" },
34 { "<leader>rq", "<cmd>OverseerQuickAction<cr>", desc = "Quick action on task" },
35 },
36 opts = {
37 -- Patches nvim-dap so a debug config can set preLaunchTask/postDebugTask
38 -- to an overseer task name (or "${defaultBuildTask}" for whatever task
39 -- is tagged BUILD) - lets a dap.configurations entry build before it
40 -- launches the debugger. See README's Debugging section.
41 dap = true,
42 -- overseer's actual default components (on_exit_set_status,
43 -- on_complete_notify, on_complete_dispose) don't open the output panel
44 -- on their own - without open_output added here, starting any task
45 -- (whether from a template, .nvim.lua/project_run.lua, or auto-detected
46 -- npm/make scripts) runs silently until you manually <leader>ro to look.
47 -- Adding it here applies to every task, not just custom ones.
48 component_aliases = {
49 default = {
50 "on_exit_set_status",
51 "on_complete_notify",
52 { "on_complete_dispose", require_view = { "SUCCESS", "FAILURE" } },
53 { "open_output", direction = "dock", focus = false, on_start = "always" },
54 },
55 },
56 },
57}