diff --git a/doc/reference.md b/doc/reference.md index 6574518..8a2009a 100644 --- a/doc/reference.md +++ b/doc/reference.md @@ -86,6 +86,8 @@ require("overseer").setup({ strategy = "terminal", -- Template modules to load templates = { "builtin" }, + -- Additional template directories to include (relative to rtp) + template_dirs = { "overseer.template" }, -- When true, tries to detect a green color from your colorscheme to use for success highlight auto_detect_success_color = true, -- Patch nvim-dap to support preLaunchTask and postDebugTask diff --git a/lua/overseer/config.lua b/lua/overseer/config.lua index fa72bee..fc9057c 100644 --- a/lua/overseer/config.lua +++ b/lua/overseer/config.lua @@ -3,6 +3,8 @@ local default_config = { strategy = "terminal", -- Template modules to load templates = { "builtin" }, + -- Directories where overseer will look for template definitions (relative to rtp) + template_dirs = { "overseer.template" }, -- When true, tries to detect a green color from your colorscheme to use for success highlight auto_detect_success_color = true, -- Patch nvim-dap to support preLaunchTask and postDebugTask diff --git a/lua/overseer/template/init.lua b/lua/overseer/template/init.lua index 7a8e19e..2810f07 100644 --- a/lua/overseer/template/init.lua +++ b/lua/overseer/template/init.lua @@ -140,7 +140,13 @@ end ---@param name string M.load_template = function(name) - local ok, defn = pcall(require, string.format("overseer.template.%s", name)) + local ok, defn + for _, template_dir in ipairs(config.template_dirs) do + ok, defn = pcall(require, string.format("%s.%s", template_dir, name)) + if ok then + break + end + end if not ok then log:error("Error loading template '%s': %s", name, defn) return