feat(overseer): Add templates for compiling and watching typst files
This commit is contained in:
parent
3ae9e70c4d
commit
ec74c2d18f
22
lua/overseer/template/typst/compile.lua
Normal file
22
lua/overseer/template/typst/compile.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
local overseer = require("overseer")
|
||||
|
||||
return {
|
||||
name = "Compile typst",
|
||||
builder = function()
|
||||
local file = vim.fn.expand("%:p")
|
||||
local cwd = vim.fn.getcwd()
|
||||
|
||||
return {
|
||||
name = "Compile " .. vim.fn.bufname(),
|
||||
cmd = { "typst" },
|
||||
args = { "compile", file, "--root", cwd },
|
||||
}
|
||||
end,
|
||||
tags = {overseer.TAG.BUILD},
|
||||
condition = {
|
||||
filetype = { "typst" },
|
||||
callback = function()
|
||||
return vim.fn.executable("typst") == 1
|
||||
end,
|
||||
},
|
||||
}
|
29
lua/overseer/template/typst/watch.lua
Normal file
29
lua/overseer/template/typst/watch.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
return {
|
||||
name = "Watch typst",
|
||||
params = {
|
||||
pdf_viewer = {
|
||||
type = "string",
|
||||
optional = false,
|
||||
default = "xdg-open",
|
||||
validate = function(value)
|
||||
return vim.fn.executable(value) ~= 0
|
||||
end,
|
||||
},
|
||||
},
|
||||
builder = function(params)
|
||||
local file = vim.fn.expand("%:p")
|
||||
local cwd = vim.fn.getcwd()
|
||||
|
||||
return {
|
||||
name = "Watch " .. vim.fn.bufname(),
|
||||
cmd = { "typst" },
|
||||
args = { "watch", file, "--root", cwd, "--open", params.pdf_viewer },
|
||||
}
|
||||
end,
|
||||
condition = {
|
||||
filetype = { "typst" },
|
||||
callback = function()
|
||||
return vim.fn.executable("typst") == 1
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,12 +1,17 @@
|
|||
return {
|
||||
'stevearc/overseer.nvim',
|
||||
opts = {},
|
||||
keys = {
|
||||
{"<leader>ot", "<cmd>OverseerToggle<cr>", desc = "Toggle Overseer"},
|
||||
{"<leader>or", "<cmd>OverseerRun<cr>", desc = "Start an Overseer task"},
|
||||
{"<leader>os", "<cmd>OverseerRunCmd<cr>", desc = "Run a shell command with Overseer"},
|
||||
{"<leader>ob", "<cmd>OverseerBuild<cr>", desc = "Open the Overseer task builder"},
|
||||
{"<leader>oo", "<cmd>OverseerOpen<cr>", desc = "Open a window with the output of an Overseer task"},
|
||||
{"<leader>oa", "<cmd>OverseerTaskAction<cr>", desc = "Add an action to an Overseer task"},
|
||||
},
|
||||
'stevearc/overseer.nvim',
|
||||
opts = {
|
||||
templates = {
|
||||
"typst.watch",
|
||||
"typst.compile",
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{"<leader>ot", "<cmd>OverseerToggle<cr>", desc = "Toggle Overseer"},
|
||||
{"<leader>or", "<cmd>OverseerRun<cr>", desc = "Start an Overseer task"},
|
||||
{"<leader>os", "<cmd>OverseerRunCmd<cr>", desc = "Run a shell command with Overseer"},
|
||||
{"<leader>ob", "<cmd>OverseerBuild<cr>", desc = "Open the Overseer task builder"},
|
||||
{"<leader>oo", "<cmd>OverseerOpen<cr>", desc = "Open a window with the output of an Overseer task"},
|
||||
{"<leader>oa", "<cmd>OverseerTaskAction<cr>", desc = "Add an action to an Overseer task"},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue