diff options
| author | Aotrix <[email protected]> | 2026-01-31 21:18:45 +0100 |
|---|---|---|
| committer | Aotrix <[email protected]> | 2026-01-31 21:18:45 +0100 |
| commit | ac5c1f1d92fd3e41562350c2c099b8e5f4a1246f (patch) | |
| tree | b7f7afd7374517efb08472512a08ad13f9266885 | |
| parent | 29264ecaa8307c01e32978ad8cc52781cfafdb9b (diff) | |
add compile shortcut
| -rw-r--r-- | lua/aotrix/compile.lua | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/lua/aotrix/compile.lua b/lua/aotrix/compile.lua index 9b0c58b..e7c9556 100644 --- a/lua/aotrix/compile.lua +++ b/lua/aotrix/compile.lua @@ -80,6 +80,28 @@ function compileTarget() if not (pTarget == nil) and string.len(pTarget) > 0 then createFloatingTerminal() local commandTable = { + "cmake --build " .. build_dir .. " --target " .. pTarget + } + local commandConcatenation = "" + for i, command in ipairs(commandTable) do + commandConcatenation = commandConcatenation .. command + if i < #commandTable then + commandConcatenation = commandConcatenation .. " && " + end + end + executeCommandInTerminal(commandConcatenation) + end + end + + defineBuildFolderPath() + chooseTarget(compile) +end + +function compileAndExecuteTarget() + function compileAndExecute(pTarget) + if not (pTarget == nil) and string.len(pTarget) > 0 then + createFloatingTerminal() + local commandTable = { "cmake --build " .. build_dir .. " --target " .. pTarget, build_dir .. "/" .. pTarget } @@ -95,7 +117,8 @@ function compileTarget() end defineBuildFolderPath() - chooseTarget(compile) + chooseTarget(compileAndExecute) end -vim.keymap.set("n", "mt", compileTarget) +vim.keymap.set("n", "mc", compileTarget) +vim.keymap.set("n", "mt", compileAndExecuteTarget) |
