-- English comments only. local ok_dap, dap = pcall(require, "dap") if not ok_dap then return end local ok_dapui, dapui = pcall(require, "dapui") if not ok_dapui then return end dapui.setup({ layouts = { { elements = { { id = "scopes", size = 0.35 }, { id = "breakpoints", size = 0.20 }, { id = "stacks", size = 0.25 }, { id = "watches", size = 0.20 }, }, position = "left", size = 45, }, { elements = { { id = "repl", size = 0.50 }, { id = "console", size = 0.50 }, }, position = "bottom", size = 12, }, }, }) -- Auto open/close dapui 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 -- Visible signs in gutter vim.fn.sign_define("DapBreakpoint", { text = "●", texthl = "DiagnosticError" }) vim.fn.sign_define("DapBreakpointCondition", { text = "◆", texthl = "DiagnosticWarn" }) vim.fn.sign_define("DapLogPoint", { text = "◆", texthl = "DiagnosticInfo" }) vim.fn.sign_define("DapStopped", { text = "▶", texthl = "DiagnosticOk" }) -- Keymaps vim.keymap.set("n", "", dap.continue, { desc = "DAP continue" }) vim.keymap.set("n", "", dap.step_over, { desc = "DAP step over" }) vim.keymap.set("n", "", dap.step_into, { desc = "DAP step into" }) vim.keymap.set("n", "", dap.step_out, { desc = "DAP step out" }) vim.keymap.set("n", "db", dap.toggle_breakpoint, { desc = "DAP toggle breakpoint" }) vim.keymap.set("n", "dB", function() dap.set_breakpoint(vim.fn.input("Breakpoint condition: ")) end, { desc = "DAP conditional breakpoint" }) vim.keymap.set("n", "dc", dap.clear_breakpoints, { desc = "DAP clear breakpoints" }) vim.keymap.set("n", "dl", function() dap.run_last() end, { desc = "DAP run last" }) vim.keymap.set("n", "dr", dap.repl.open, { desc = "DAP REPL" }) vim.keymap.set("n", "du", dapui.toggle, { desc = "DAP UI toggle" }) -- Evaluate helpers vim.keymap.set("n", "de", function() dapui.eval() end, { desc = "DAP eval under cursor" }) vim.keymap.set("v", "de", function() dapui.eval() end, { desc = "DAP eval selection" }) -- Optional: hover to eval during debug (nice IDE behavior) vim.keymap.set("n", "dh", function() dapui.eval() end, { desc = "DAP hover eval" })