feat: núcleo del plugin NCS (build, flash, LSP)

Primera versión funcional del plugin para nRF Connect SDK en LazyVim.

Incluye:
- setup() con opciones por proyecto y API pública (build, flash)
- detect: resolución en runtime de versión NCS, toolchain y board
  (sin hashes hardcodeados)
- exec: wrapper async sobre vim.system + entorno NCS
- west: construcción del comando build (--sysbuild, -DCONF_FILE,
  -DDTC_OVERLAY_FILE, -DCMAKE_EXPORT_COMPILE_COMMANDS=ON)
- lsp: symlink de compile_commands.json desde build/<image>/ y
  LspRestart (clangd solo lo lee al arrancar)
- flash: detección de placas vía nrfutil device list + selector
- keymaps: <leader>nb (build), <leader>np (pristine), <leader>nf (flash)
This commit is contained in:
unai committed 2026-10-10 18:36:16 +02:00
1 parent 03a43a686f
commit a4a5bfe636
8 files changed
+297

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
local M = {}
function M.build(opts, pristine)
local a = { "build", "-d", opts.build_dir, vim.fn.getcwd(), "--board", opts.board }
if opts.sysbuild then
table.insert(a, "--sysbuild")
end
if pristine then
table.insert(a, "--pristine")
end
table.insert(a, "--")
table.insert(a, "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON")
if opts.conf_file then
table.insert(a, "-DCONF_FILE=" .. opts.conf_file)
end
if #opts.overlays > 0 then
table.insert(a, "-DDTC_OVERLAY_FILE=" .. table.concat(opts.overlays, ";"))
end
for _, e in ipairs(opts.extra_cmake or {}) do
table.insert(a, e)
end
local exec = require("hego.exec")
local cmd = exec.ncs(opts, vim.list_extend({ "west" }, a))
return exec.run_async(cmd, {
title = "hego://build",
on_exit = function(obj)
if obj.code == 0 then
require("hego.lsp").link(opts)
end
end,
})
end
return M