aboutsummaryrefslogtreecommitdiff
path: root/lua/cmake/actions.lua
diff options
context:
space:
mode:
authorDaniil Rozanov <daniilrozzanov@gmail.com>2024-04-24 04:06:35 +0300
committerDaniil Rozanov <daniilrozzanov@gmail.com>2024-04-24 04:06:35 +0300
commit0703f679c83da5254f50b1e78af1220a3a6882a4 (patch)
treed56bb692b3a2652cc1e727872d3f7f496051aa8c /lua/cmake/actions.lua
parentf9b36bf730fda5488be87b91fd03a6f7cbf64e73 (diff)
fix: properly run last executable
Diffstat (limited to 'lua/cmake/actions.lua')
-rw-r--r--lua/cmake/actions.lua19
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