other loops in creation. LANG: Added CPP and bugfixed c to use c code and not python
27 lines
856 B
Lua
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
|