Closed yoplat closed 11 months ago
If you need to store your templates in a different directory, you can always require
them yourself and pass them in directly using register_template
https://github.com/stevearc/overseer.nvim/blob/master/doc/guides.md#custom-tasks
If you need to store your templates in a different directory, you can always
require
them yourself and pass them in directly usingregister_template
https://github.com/stevearc/overseer.nvim/blob/master/doc/guides.md#custom-tasks
I don't know if I'm doing something wrong, this is the file that I'm requiring:
return {
name = "run script",
builder = function()
local file = vim.fn.expand "%:p"
local cmd = { file }
if vim.bo.filetype == "go" then
cmd = { "go", "run", file }
end
return {
cmd = cmd,
components = {
{ "on_output_quickfix", set_diagnostics = true },
"on_result_diagnostics",
"default",
},
}
end,
condition = {
filetype = { "sh", "python", "go" },
},
}
And this is how I'm setting it up:
{
"stevearc/overseer.nvim",
cmd = { "OverseerRun", "OverseerToggle" },
config = function(_, opts)
local overseer = require "overseer"
overseer.setup(opts)
overseer.register_template {
require "custom.overseer.template.user.run_script",
}
end,
},
But it complains that builder expected a function but return nil, but if I try to copy the contents of the file (without the return) it works (filepath I'm sure it's right). Any tips? I even tried enclosing the require in brackets but that gave an error where it wouldn't even find the name of the template so I don't think that's the way.
Try changing
overseer.register_template {
require "custom.overseer.template.user.run_script",
}
to
overseer.register_template(
require "custom.overseer.template.user.run_script",
)
Try changing
overseer.register_template { require "custom.overseer.template.user.run_script", }
to
overseer.register_template( require "custom.overseer.template.user.run_script", )
That worked thanks!
I'm using a custom config of NvChad, so I can't use the standard path of lua/overseer as that would mess up the git repo, is there a way to specify a custom templates directory? In this case it would be lua/custom/overseer/templates as opposed to lua/overseer/template? I tried reading the default config options and didn't find anything for this