2025-12-05 17:00:35 -08:00

81 lines
2.1 KiB
Lua

return {
"mfussenegger/nvim-dap",
dependencies = { "rcarriga/nvim-dap-ui", "nvim-neotest/nvim-nio" },
config = function()
local dapui = require("dapui")
local dap = require("dap")
-- open the ui as soon as we are debugging
dap.listeners.after.event_initialized["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
-- https://emojipedia.org/en/stickers/search?q=circle
vim.fn.sign_define("DapBreakpoint", {
text = "",
texthl = "DapBreakpointSymbol",
linehl = "DapBreakpoint",
numhl = "DapBreakpoint",
})
vim.fn.sign_define("DapStopped", {
text = "🔴",
texthl = "yellow",
linehl = "DapBreakpoint",
numhl = "DapBreakpoint",
})
vim.fn.sign_define("DapBreakpointRejected", {
text = "",
texthl = "DapStoppedSymbol",
linehl = "DapBreakpoint",
numhl = "DapBreakpoint",
})
local map, opts = vim.keymap.set, { noremap = true, silent = true }
map("n", "<leader>du", function()
dapui.toggle()
end, { noremap = true, silent = true, desc = "Toggle DAP UI" })
map({ "n", "v" }, "<leader>dw", function()
require("dapui").eval(nil, { enter = true })
end, { noremap = true, silent = true, desc = "Add word under cursor to Watches" })
map({ "n", "v" }, "Q", function()
require("dapui").eval()
end, {
noremap = true,
silent = true,
desc = "Hover/eval a single value (opens a tiny window instead of expanding the full object) ",
})
-- more minimal ui
dapui.setup({
expand_lines = true,
controls = { enabled = false }, -- no extra play/step buttons
floating = { border = "rounded" },
-- Set dapui window
render = {
max_type_length = 60,
max_value_lines = 200,
},
-- Only one layout: just the "scopes" (variables) list at the bottom
layouts = {
{
elements = {
{ id = "scopes", size = 1.0 }, -- 100% of this panel is scopes
},
size = 15, -- height in lines (adjust to taste)
position = "bottom", -- "left", "right", "top", "bottom"
},
},
})
end,
}