CHORE: Bug fixed c and cpp files and fixed their templates. Bug #3 is

also done
This commit is contained in:
2026-10-23 09:30:37 -04:00
parent 1c4a61ce7f
commit 4bf705df03
5 changed files with 76 additions and 44 deletions
+3 -1
View File
@@ -19,9 +19,11 @@ function M.create_project(opts)
---@type VernCConfig
local cfg = vim.tbl_deep_extend("force", {}, configs, configs, opts or {})
local root = join(vim.fn.expand(cfg.workspace_root), cfg.c.root, pname)
local build_cmd = "cd " .. root .. " && cmake -S . -B build"
local bin = action_utils.create(cfg.c, pname, root)
local build_cmd = "cd " .. root .. " && cmake -S . -B build"
local _ = vim.system({ "sh", "-c", build_cmd }):wait()
utils.init_git(root, "c")
vim.cmd.edit(vim.fn.fnameescape(bin))
+7 -2
View File
@@ -20,19 +20,24 @@ function M.create_project(opts)
local cfg = vim.tbl_deep_extend("force", {}, configs, configs, opts or {})
local root = join(vim.fn.expand(cfg.workspace_root), cfg.cpp.root, pname)
local bin = action_utils.create(cfg.cpp, pname, root)
utils.init_git(root, "c")
local build_cmd = "cd " .. root .. " && cmake -S . -B build"
local _ = vim.system({ "sh", "-c", build_cmd }):wait()
utils.init_git(root, "cpp")
vim.cmd.edit(vim.fn.fnameescape(bin))
end)
end
---@param opts VernCPPConfig
function M.create_file(opts)
vim.ui.input({ prompt = "Enter type (c/h): " }, function(ft)
ft = ft and vim.trim(ft)
if not ft or ft == "" then
return
end
local configs = require("vern.configs.c")
local configs = require("vern.configs.cpp")
---@type VernCPPConfig
local cfg = vim.tbl_deep_extend("force", {}, configs, opts or {})
vim.ui.input({ prompt = "Enter file name: " }, function(fname)
+1 -1
View File
@@ -64,7 +64,7 @@ function M.run(opts)
local exe = join(bin.path, bin.name) or "src/{project_name}/main.py"
local exe_path = utils.resolve_path(exe, opts.python.dirs, { project_name = pname })
local full_path = join(vim.fn.expand(root), exe_path)
utils.term({ "python3 " .. full_path }, opts.terminal or {})
utils.term({ "python3 " .. full_path }, opts.terminal or {}, false)
end
function M.pip_install()