return { { "mfussenegger/nvim-dap", dependencies = { "nvim-neotest/nvim-nio", "rcarriga/nvim-dap-ui", "mfussenegger/nvim-dap-python", "theHamsta/nvim-dap-virtual-text", }, config = function() local dap = require("dap") local dapui = require("dapui") local dap_python = require("dap-python") require("dapui").setup() require("nvim-dap-virtual-text").setup({ commented = true, -- Show virtual text alongside comment }) dap_python.setup("python3") table.insert(require('dap').configurations.python, { justMyCode = false, type = 'python'; request = 'launch'; name = 'file:args:allCode'; program = '${file}'; args = function() local args_string = vim.fn.input('Arguments: ') local utils = require("dap.utils") if utils.splitstr and vim.fn.has("nvim-0.10") == 1 then return utils.splitstr(args_string) end return vim.split(args_string, " +") end; -- console = opts.console; -- pythonPath = opts.pythonPath, }) vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError", linehl = "", numhl = "", }) vim.fn.sign_define("DapBreakpointRejected", { text = "", -- or "❌" texthl = "DiagnosticSignError", linehl = "", numhl = "", }) vim.fn.sign_define("DapStopped", { text = "", -- or "→" texthl = "DiagnosticSignWarn", linehl = "Visual", numhl = "DiagnosticSignWarn", }) -- Automatically open DAP UI dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open() end -- Automatically close DAP UI when session terminates dap.listeners.after.event_terminated["dapui_config"] = function() dapui.close() end dap.listeners.after.event_exited["dapui_config"] = function() dapui.close() end local opts = { noremap = true, silent = true } -- Toggle breakpoint vim.keymap.set("n", "db", function() dap.toggle_breakpoint() end, opts) -- Continue / Start vim.keymap.set("n", "dc", function() dap.continue() end, opts) -- Step Over vim.keymap.set("n", "do", function() dap.step_over() end, opts) -- Step Into vim.keymap.set("n", "di", function() dap.step_into() end, opts) -- Step Out vim.keymap.set("n", "dO", function() dap.step_out() end, opts) -- Keymap to terminate debugging vim.keymap.set("n", "dq", function() require("dap").terminate() end, opts) -- Toggle DAP UI vim.keymap.set("n", "du", function() dapui.toggle() end, opts) end, }, } -- vim: ts=2 sts=2 sw=2 et