Files
vern-nvim/lua/vern/attach/c.lua
T
DarthMooMancer b6d46a0cef Chore: moved similar functions to a utils for actions so they dont
repeat and copy costantly. Going to have to think of a better way that
consolidates it all as a lot of it overlaps
2026-10-22 14:36:19 -04:00

27 lines
867 B
Lua

local actions = require("vern.actions.python")
local config = require("vern.configs.python")
---@param bufnr integer Buffer to activate on : defaults to 0
---@param user_opts? VernPythonConfig
return function(bufnr, user_opts)
---@type VernPythonConfig
local opts = vim.tbl_deep_extend("force", {}, config, user_opts or {})
vim.api.nvim_buf_create_user_command(bufnr, "CRun", function()
if type(actions.run) == "function" then
actions.run(opts)
end
end, { desc = "Run c project" })
for key, def in pairs(opts.python.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