mirror of
https://github.com/d0zingcat/dotfiles.git
synced 2026-05-13 15:09:34 +00:00
- 架构重构:新增 plugins/lang/ 子目录,按语言拆分配置 - 补全引擎:nvim-cmp → blink.cmp + LuaSnip - 文件浏览:新增 neo-tree(<Space>e) - 语言支持: - Go: ray-x/go.nvim + dap-go + neotest-go - Rust: rustaceanvim + crates.nvim - Python: venv-selector + dap-python + neotest-python - TypeScript: typescript-tools.nvim(替换 ts_ls) - LSP: lazydev + mason + mason-lspconfig + fidget + inc-rename - 格式化: conform.nvim(lsp_format fallback,保存时自动格式化) - Lint: nvim-lint(selene 替换 luacheck,Mason 可直接安装) - UI: snacks.nvim(dashboard+notifier+picker)+ noice + lualine + bufferline - 编辑增强: mini.ai + mini.surround + grug-far + flash + ufo + trouble v3 - 删除废弃文件: cmp/coding/null-ls/mason/lspconfig/go/python 等旧文件 - 修复: Neovim 0.12 treesitter query 校验报错(noice routes 过滤) - 新增: NVIM_GUIDE.md 快捷键使用手册 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
83 lines
3.2 KiB
Lua
83 lines
3.2 KiB
Lua
-- dap.lua - 调试适配器协议(通用配置)
|
|
|
|
return {
|
|
{
|
|
"mfussenegger/nvim-dap",
|
|
dependencies = {
|
|
{
|
|
"rcarriga/nvim-dap-ui",
|
|
dependencies = { "nvim-neotest/nvim-nio" },
|
|
opts = {
|
|
icons = { expanded = "▾", collapsed = "▸", current_frame = "▸" },
|
|
layouts = {
|
|
{
|
|
elements = {
|
|
{ id = "scopes", size = 0.25 },
|
|
{ id = "breakpoints", size = 0.25 },
|
|
{ id = "stacks", size = 0.25 },
|
|
{ id = "watches", size = 0.25 },
|
|
},
|
|
size = 40,
|
|
position = "left",
|
|
},
|
|
{
|
|
elements = {
|
|
{ id = "repl", size = 0.5 },
|
|
{ id = "console", size = 0.5 },
|
|
},
|
|
size = 15,
|
|
position = "bottom",
|
|
},
|
|
},
|
|
floating = { border = "rounded" },
|
|
},
|
|
config = function(_, opts)
|
|
local dap = require("dap")
|
|
local dapui = require("dapui")
|
|
dapui.setup(opts)
|
|
dap.listeners.after.event_initialized["dapui_config"] = dapui.open
|
|
dap.listeners.before.event_terminated["dapui_config"] = dapui.close
|
|
dap.listeners.before.event_exited["dapui_config"] = dapui.close
|
|
end,
|
|
},
|
|
{
|
|
"theHamsta/nvim-dap-virtual-text",
|
|
opts = { commented = true },
|
|
},
|
|
},
|
|
keys = {
|
|
{ "<leader>dB", function() require("dap").set_breakpoint(vim.fn.input("断点条件: ")) end, desc = "条件断点" },
|
|
{ "<leader>db", function() require("dap").toggle_breakpoint() end, desc = "切换断点" },
|
|
{ "<leader>dc", function() require("dap").continue() end, desc = "继续/启动" },
|
|
{ "<leader>dC", function() require("dap").run_to_cursor() end, desc = "运行到光标" },
|
|
{ "<leader>di", function() require("dap").step_into() end, desc = "单步进入" },
|
|
{ "<leader>do", function() require("dap").step_out() end, desc = "单步跳出" },
|
|
{ "<leader>dO", function() require("dap").step_over() end, desc = "单步跳过" },
|
|
{ "<leader>dl", function() require("dap").run_last() end, desc = "重新运行" },
|
|
{ "<leader>dt", function() require("dap").terminate() end, desc = "终止调试" },
|
|
{ "<leader>dr", function() require("dap").repl.toggle() end, desc = "REPL" },
|
|
{ "<leader>du", function() require("dapui").toggle() end, desc = "调试 UI" },
|
|
{ "<leader>dw", function() require("dap.ui.widgets").hover() end, desc = "悬浮变量" },
|
|
},
|
|
config = function()
|
|
vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" })
|
|
local signs = {
|
|
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
|
Breakpoint = " ",
|
|
BreakpointCondition = " ",
|
|
BreakpointRejected = { " ", "DiagnosticError" },
|
|
LogPoint = ".>",
|
|
}
|
|
for name, sign in pairs(signs) do
|
|
sign = type(sign) == "table" and sign or { sign }
|
|
vim.fn.sign_define("Dap" .. name, {
|
|
text = sign[1],
|
|
texthl = sign[2] or "DiagnosticInfo",
|
|
linehl = sign[3],
|
|
numhl = sign[3],
|
|
})
|
|
end
|
|
end,
|
|
},
|
|
}
|