diff options
Diffstat (limited to 'lua/cmake/actions.lua')
-rw-r--r-- | lua/cmake/actions.lua | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lua/cmake/actions.lua b/lua/cmake/actions.lua index d330a0a..ff64f95 100644 --- a/lua/cmake/actions.lua +++ b/lua/cmake/actions.lua @@ -1,6 +1,7 @@ local pr = require("cmake.project") local config = require("cmake.config") local t = require("cmake.terminal") +local Path = require("plenary.path") local M = {} @@ -83,7 +84,16 @@ M.build_select = function(opts) end M.run_tagret = function(opts) - return + opts = opts or {} + local _curr_exe_cmd = pr.current_executable_target() + if not _curr_exe_cmd then + M.run_tagret_select(opts) + else + local command = { + cmd = Path:new(pr.current_directory(), _curr_exe_cmd.path):make_relative(vim.loop.cwd()), + } + t.target_execute(command) + end end M.run_tagret_select = function(opts) @@ -101,11 +111,14 @@ M.run_tagret_select = function(opts) end pr.set_current_executable_target(idx) local command = { - cwd = pr.current_directory(), - cmd = choice.path, + cmd = Path:new(pr.current_directory(), choice.path):make_relative(vim.loop.cwd()), } t.target_execute(command) end) end +M.toggle = function() + t.cmake_toggle() +end + return M |