nvim/.config/nvim/lua/plugins/dap/core.lua

-- nvim/.config/nvim/lua/plugins/dap/core.lua

return {
  {
    "mfussenegger/nvim-dap",
    dependencies = {
      "rcarriga/nvim-dap-ui",
      "nvim-neotest/nvim-nio",
      "theHamsta/nvim-dap-virtual-text",
    },
    keys = {
      { "<leader>db", function() require("dap").toggle_breakpoint() end, desc = "breakpoint" },
      { "<leader>dB", function()
          require("dap").set_breakpoint(vim.fn.input("Condition: "))
        end, desc = "cond breakpoint" },
      { "<leader>dc", function() require("dap").continue() end,         desc = "continue" },
      { "<leader>di", function() require("dap").step_into() end,        desc = "step in" },
      { "<leader>do", function() require("dap").step_over() end,        desc = "step over" },
      { "<leader>dO", function() require("dap").step_out() end,         desc = "step out" },
      { "<leader>dt", function() require("dap").terminate() end,        desc = "terminate" },
      { "<leader>dr", function() require("dap").repl.toggle() end,      desc = "repl" },
      { "<leader>du", function() require("dapui").toggle({}) end,       desc = "dap ui" },
    },
    config = function()
      local dap  = require("dap")
      local dapu = require("dapui")

      dapu.setup({
        layouts = {
          {
            elements = {
              { id = "scopes",      size = 0.33 },
              { id = "breakpoints", size = 0.17 },
              { id = "stacks",      size = 0.25 },
              { id = "watches",     size = 0.25 },
            },
            size = 0.33,
            position = "right",
          },
          { elements = { { id = "repl", size = 1.0 } }, size = 0.27, position = "bottom" },
        },
      })
      require("nvim-dap-virtual-text").setup({ commented = true })

      dap.listeners.after.event_initialized["dapui"] = function() dapu.open() end
      dap.listeners.before.event_terminated["dapui"] = function() dapu.close() end
      dap.listeners.before.event_exited["dapui"]     = function() dapu.close() end

      vim.fn.sign_define("DapBreakpoint",         { text = "●", texthl = "DiagnosticError", numhl = "" })
      vim.fn.sign_define("DapBreakpointCondition",{ text = "◉", texthl = "DiagnosticWarn",  numhl = "" })
      vim.fn.sign_define("DapStopped",            { text = "▶", texthl = "DiagnosticInfo",  numhl = "" })
    end,
  },
}