From 873b17f69e01a447631c6dcb462bb69d2cc7993a Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sun, 23 Jun 2024 05:52:46 -0500 Subject: [PATCH] feat(nvim): add `Overseer.nvim` --- .../nvim/lua/plugins/configs/heirline.lua | 2 +- .../nvim/lua/plugins/configs/overseer.lua | 61 +++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 users/price/dots/.config/nvim/lua/plugins/configs/overseer.lua diff --git a/users/price/dots/.config/nvim/lua/plugins/configs/heirline.lua b/users/price/dots/.config/nvim/lua/plugins/configs/heirline.lua index 522aa2ec..d3489e67 100644 --- a/users/price/dots/.config/nvim/lua/plugins/configs/heirline.lua +++ b/users/price/dots/.config/nvim/lua/plugins/configs/heirline.lua @@ -1108,7 +1108,7 @@ return { disable_winbar_cb = function(args) return conditions.buffer_matches({ buftype = { "nofile", "prompt", "quickfix", "terminal" }, - filetype = { "fugitive", "Trouble", "dashboard", ".*neogit.*", "no-neck-pain" }, + filetype = { "fugitive", "Trouble", "dashboard", ".*neogit.*", "Overseer.*" }, }, args.buf) end, }, diff --git a/users/price/dots/.config/nvim/lua/plugins/configs/overseer.lua b/users/price/dots/.config/nvim/lua/plugins/configs/overseer.lua new file mode 100644 index 00000000..fdaec983 --- /dev/null +++ b/users/price/dots/.config/nvim/lua/plugins/configs/overseer.lua @@ -0,0 +1,61 @@ +return { + { + "stevearc/overseer.nvim", + cmd = { + "OverseerOpen", + "OverseerClose", + "OverseerToggle", + "OverseerSaveBundle", + "OverseerLoadBundle", + "OverseerDeleteBundle", + "OverseerRunCmd", + "OverseerRun", + "OverseerInfo", + "OverseerBuild", + "OverseerQuickAction", + "OverseerTaskAction", + "OverseerClearCache", + }, + keys = { + { "r", desc = "Overseer" }, + { "rr", "OverseerRun", desc = "Overseer: Run" }, + { "rt", "OverseerToggle", desc = "Overseer: Toggle" }, + }, + config = function() + local overseer = require("overseer") + overseer.setup() + local tempname_caches = {} + + --- Get a temp file bound to the bufnr + local function tempname() + local bufnr = vim.api.nvim_get_current_buf() + if not tempname_caches[bufnr] then + tempname_caches[bufnr] = vim.fn.tempname() + end + return tempname_caches[bufnr] + end + overseer.register_template( + ---@type overseer.TemplateDefinition + { + name = "Watch Typst", + desc = "Run `typst watch` and view the PDF", + ---@return overseer.TaskDefinition + builder = function(_) + return { + cmd = { + "typst", + "watch", + "--open=xdg-open", + vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()), + tempname() .. ".pdf", + }, + } + end, + condition = { + filetype = "typst", + }, + } + ) + end, + }, +}