- 分层架构:config/{options,keymaps,lazy} + plugins/
- 保留:blink.cmp, oil.nvim, runner.lua, cmake-tools, diffview, tokyonight
- 新增 UI:bufferline, lualine, noice, nvim-notify, dashboard, dressing
- 新增编辑器:Comment, nvim-surround, vim-illuminate, toggleterm, flash
- 新增视觉:indent-blankline, nvim-ufo, rainbow-delimiters
- 新增 Git:lazygit 集成
- 新增 DAP:persistent-breakpoints, nvim-dap-virtual-text
- 修复:which-key 启用, rustaceanvim 填充, 键位冲突解决
- 语法检查:22/22 文件全部通过 luajit -b
100 lines
3.3 KiB
Lua
100 lines
3.3 KiB
Lua
-- =============================================================================
|
|
-- dap.lua — DAP 调试器
|
|
-- =============================================================================
|
|
-- 【保留】你的完整 DAP 配置(codelldb + dap-ui + mason-nvim-dap)。
|
|
-- 【新增】✅ persistent-breakpoints 持久化断点;
|
|
-- ✅ nvim-dap-virtual-text 虚拟变量值显示。
|
|
|
|
return {
|
|
{
|
|
"mfussenegger/nvim-dap",
|
|
dependencies = {
|
|
"rcarriga/nvim-dap-ui",
|
|
"nvim-neotest/nvim-nio",
|
|
"williamboman/mason.nvim",
|
|
-- ✅ 新增:虚拟文本显示变量值
|
|
{ "theHamsta/nvim-dap-virtual-text", opts = {} },
|
|
-- ✅ 新增:持久化断点
|
|
{ "Weissle/persistent-breakpoints.nvim", opts = { load_breakpoints_event = { "BufReadPost" } } },
|
|
},
|
|
config = function()
|
|
local dap = require("dap")
|
|
local dapui = require("dapui")
|
|
|
|
-- 断点图标(保留你的设置)
|
|
vim.fn.sign_define("DapBreakpoint",
|
|
{ text = "●", texthl = "DapBreakpoint", linehl = "", numhl = "" })
|
|
vim.fn.sign_define("DapBreakpointCondition",
|
|
{ text = "◆", texthl = "DapBreakpointCondition", linehl = "", numhl = "" })
|
|
vim.fn.sign_define("DapStopped",
|
|
{ text = "▶", texthl = "DapStopped", linehl = "CursorLine", numhl = "" })
|
|
|
|
-- dap-ui 布局(保留你的设置)
|
|
dapui.setup({
|
|
layouts = {
|
|
{
|
|
elements = {
|
|
{ id = "stacks", size = 0.25 },
|
|
{ id = "scopes", size = 0.25 },
|
|
{ id = "breakpoints", size = 0.25 },
|
|
{ id = "watches", size = 0.25 },
|
|
},
|
|
position = "left",
|
|
size = 40,
|
|
},
|
|
{
|
|
elements = {
|
|
{ id = "repl", size = 0.5 },
|
|
{ id = "console", size = 0.5 },
|
|
},
|
|
position = "bottom",
|
|
size = 10,
|
|
},
|
|
},
|
|
})
|
|
|
|
-- 调试会话自动打开/关闭 UI
|
|
dap.listeners.before.attach.dapui_config = function() dapui.open() end
|
|
dap.listeners.before.launch.dapui_config = function() dapui.open() end
|
|
dap.listeners.before.event_terminated.dapui_config = function() dapui.close() end
|
|
dap.listeners.before.event_exited.dapui_config = function() dapui.close() end
|
|
|
|
-- codelldb 适配器
|
|
dap.adapters.codelldb = {
|
|
type = "server",
|
|
port = "${port}",
|
|
executable = {
|
|
command = vim.fn.stdpath("data") .. "/mason/bin/codelldb",
|
|
args = { "--port", "${port}" },
|
|
},
|
|
}
|
|
|
|
-- C/C++ 调试配置
|
|
dap.configurations.c = {
|
|
{
|
|
name = "Launch",
|
|
type = "codelldb",
|
|
request = "launch",
|
|
program = function()
|
|
return vim.fn.input("可执行文件路径: ", vim.fn.getcwd() .. "/", "file")
|
|
end,
|
|
cwd = "${workspaceFolder}",
|
|
stopOnEntry = false,
|
|
args = {},
|
|
},
|
|
}
|
|
dap.configurations.cpp = dap.configurations.c
|
|
end,
|
|
},
|
|
|
|
-- Mason DAP 自动安装
|
|
{
|
|
"jay-babu/mason-nvim-dap.nvim",
|
|
dependencies = { "williamboman/mason.nvim", "mfussenegger/nvim-dap" },
|
|
lazy = false,
|
|
opts = {
|
|
ensure_installed = { "codelldb" },
|
|
},
|
|
},
|
|
}
|