This commit is contained in:
DarthMooMancer
2025-08-22 19:30:24 -04:00
parent 66ae61f2c9
commit 0cc4374865
2 changed files with 158 additions and 150 deletions
+4 -1
View File
@@ -89,6 +89,10 @@ M.languages = {
run = function ()
local root = utils.get_project_root()
local build_dir = root .. "/build"
if utils.exists(build_dir) == nil then
vim.fn.mkdir(build_dir, "p")
vim.fn.system(string.format("cd %s/build && cmake -S .. -B . && cmake --build . && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. && ln -sf compile_commands.json ../compile_commands.json", root))
end
local cmd = "cd '" .. build_dir .. "' && cmake --build ."
local output = vim.fn.system(cmd)
@@ -102,7 +106,6 @@ M.languages = {
vim.list_extend({ "Error during compilation:" }, vim.split(output, "\n", { trimempty = true }))
)
vim.api.nvim_set_option_value("modifiable", false, { buf = term_buf })
end
if success then
local run_cmd = "cd '" .. build_dir .. "' && ./" .. utils.get_project_name()
+6 -1
View File
@@ -1,10 +1,15 @@
local M = {}
M.opts = {}
function M.setup(opts)
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("terminal"), opts or {})
end
function exists(path)
return (io.open(path,"r") ~= nil)
end
---@return string
function M.get_project_root()
local plugin_dir = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":h:h:h")