Files
vern-nvim/lua/vern/attach/cpp.lua
T
DarthMooMancer 1c4a61ce7f CHORE: Fixed bug #4 by looping dirs and creating directories before
other loops in creation.
LANG: Added CPP and bugfixed c to use c code and not python
2026-10-23 08:25:21 -04:00

27 lines
856 B
Lua

local actions = require("vern.actions.cpp")
local config = require("vern.configs.cpp")
---@param bufnr integer Buffer to activate on : defaults to 0
---@param user_opts? VernCPPConfig
return function(bufnr, user_opts)
---@type VernCPPConfig
local opts = vim.tbl_deep_extend("force", {}, config, user_opts or {})
vim.api.nvim_buf_create_user_command(bufnr, "CPPRun", function()
if type(actions.run) == "function" then
actions.run(opts)
end
end, { desc = "Run cpp project" })
for key, def in pairs(opts.cpp.keybinds or {}) do
if type(def.action) == "function" then
vim.keymap.set("n", key, function()
def.action(opts)
end, {
buffer = bufnr,
silent = true,
desc = def.desc,
})
end
end
end