return { "rcarriga/nvim-dap-ui", dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio", "jay-babu/mason-nvim-dap.nvim" }, keys = { { "db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" }, { "dc", function() require("dap").continue() end, desc = "Continue" }, { "dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" }, { "dT", function() require("dap").terminate() end, desc = "Terminate" }, { "dn", function() require("dap").step_over() end, desc = "Step Over" }, { "di", function() require("dap").step_into() end, desc = "Step Into" }, { "do", function() require("dap").step_out() end, desc = "Step Out" }, { "dl", function() require("dap").run_last() end, desc = "Run Last Program" }, { "dk", function() require("dap.ui.widgets").hover() end, desc = "Hover" }, { "dp", function() require("dap.ui.widgets").preview() end, desc = "Preview" }, }, config = function() local dap, dapui = require("dap"), require("dapui") dapui.setup(); 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 -- C/C++/Rust (via gdb) dap.adapters.gdb = { type = "executable", command = "gdb", args = { "--interpreter=dap", "--eval-command", "set print pretty on" } } local c_conf = { { name = "Launch", type = "gdb", request = "launch", program = function() return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end, cwd = "${workspaceFolder}", stopAtBeginningOfMainSubprogram = false, }, { name = "Select and attach to process", type = "gdb", request = "attach", program = function() return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end, pid = function() local name = vim.fn.input('Executable name (filter): ') return require("dap.utils").pick_process({ filter = name }) end, cwd = '${workspaceFolder}' }, { name = 'Attach to gdbserver :1234', type = 'gdb', request = 'attach', target = 'localhost:1234', program = function() return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end, cwd = '${workspaceFolder}' }, } dap.configurations.c = c_conf dap.configurations.cpp = c_conf end }