diff --git a/README.md b/README.md index b0dae4c6..324ec805 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ require("cmake-tools").setup { console = "integratedTerminal", }, cmake_executor = { -- executor to use - name = "quickfix", -- name of the executor + name = "overseer", -- name of the executor opts = {}, -- the options the executor will get, possible values depend on the executor type. See `default_opts` for possible values. default_opts = { -- a list of default and possible values for executors quickfix = { @@ -60,8 +60,19 @@ require("cmake-tools").setup { auto_close_when_success = true, -- typically, you can use it with the "always" option; it will auto-close the quickfix buffer if the execution is successful. }, overseer = { - new_task_opts = {}, -- options to pass into the `overseer.new_task` command - on_new_task = function(task) end, -- a function that gets overseer.Task when it is created, before calling `task:start` + new_task_opts = { + strategy = { + "toggleterm", + direction = "horizontal", + autos_croll = true, + quit_on_exit = "success" + } + }, -- options to pass into the `overseer.new_task` command + on_new_task = function(task) + require("overseer").open( + { enter = false, direction = "right" } + ) + end, -- a function that gets overseer.Task when it is created, before calling `task:start` }, terminal = { name = "Main Terminal", @@ -93,8 +104,16 @@ require("cmake-tools").setup { auto_close_when_success = true, -- typically, you can use it with the "always" option; it will auto-close the quickfix buffer if the execution is successful. }, overseer = { - new_task_opts = {}, -- options to pass into the `overseer.new_task` command - on_new_task = function(task) end, -- a function that gets overseer.Task when it is created, before calling `task:start` + new_task_opts = { + strategy = { + "toggleterm", + direction = "horizontal", + autos_croll = true, + quit_on_exit = "success" + } + }, -- options to pass into the `overseer.new_task` command + on_new_task = function(task) + end, -- a function that gets overseer.Task when it is created, before calling `task:start` }, terminal = { name = "Main Terminal", diff --git a/lua/cmake-tools/const.lua b/lua/cmake-tools/const.lua index b47e6a47..296b3d16 100644 --- a/lua/cmake-tools/const.lua +++ b/lua/cmake-tools/const.lua @@ -32,7 +32,14 @@ local const = { auto_close_when_success = true, -- typically, you can use it with the "always" option; it will auto-close the quickfix buffer if the execution is successful. }, overseer = { - new_task_opts = {}, -- options to pass into the `overseer.new_task` command + new_task_opts = { + strategy = { + "toggleterm", + direction = "horizontal", + autos_croll = true, + quit_on_exit = "success", + }, + }, -- options to pass into the `overseer.new_task` command on_new_task = function(task) end, -- a function that gets overseer.Task when it is created, before calling `task:start` }, terminal = { @@ -65,7 +72,14 @@ local const = { auto_close_when_success = true, -- typically, you can use it with the "always" option; it will auto-close the quickfix buffer if the execution is successful. }, overseer = { - new_task_opts = {}, -- options to pass into the `overseer.new_task` command + new_task_opts = { + strategy = { + "toggleterm", + direction = "horizontal", + autos_croll = true, + quit_on_exit = "success", + }, + }, -- options to pass into the `overseer.new_task` command on_new_task = function(task) end, -- a function that gets overseer.Task when it is created, before calling `task:start` }, terminal = { diff --git a/lua/cmake-tools/overseer.lua b/lua/cmake-tools/overseer.lua index f41f851c..f7e6a658 100644 --- a/lua/cmake-tools/overseer.lua +++ b/lua/cmake-tools/overseer.lua @@ -15,15 +15,14 @@ function _overseer.close(opts) end function _overseer.run(cmd, env_script, env, args, cwd, opts, on_exit, on_output) - _overseer.show(opts) - opts = vim.tbl_extend("keep", { + local new_task_opts = vim.tbl_extend("keep", { -- cmd = env_script .. " && " .. cmd, -- Temporarily disabling envScript for Overseer: Refer #158 and #159 for more details cmd = cmd, args = args, env = env, cwd = cwd, }, opts.new_task_opts) - _overseer.job = overseer.new_task(opts) + _overseer.job = overseer.new_task(new_task_opts) if on_exit ~= nil then _overseer.job:subscribe("on_exit", function(out) on_exit(out.exit_code)