return { { 'mfussenegger/nvim-dap', config = function() local dap = require("dap") dap.adapters.gdb = { type = "executable", command = "gdb", args = { "-i", "dap" } } dap.adapters.python = function(cb, config) if config.request == 'attach' then local port = (config.connect or config).port local host = (config.connect or config).host or '127.0.0.1' cb({ type = 'server', port = assert(port, '`connect.port` is required for a python `attach` configuration'), host = host, options = { source_filetype = 'python' } }) else cb({ type = 'executable', command = 'python', args = { '-m', 'debugpy.adapter' }, options = { source_filetype = 'python' } }) end end dap.configurations.c = { { name = "Launch", type = "gdb", request = "launch", program = function() return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end, cwd = "${workspaceFolder}", stopAtBeginningOfMainSubprogram = false } } dap.configurations.cpp = { { name = "Launch", type = "gdb", request = "launch", program = function() return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end, cwd = "${workspaceFolder}", stopAtBeginningOfMainSubprogram = false } } dap.configurations.python = { { type = 'python', request = 'launch', name = "Launch file", program = "${file}", pythonPath = function() local cwd = vim.fn.getcwd() if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then return cwd .. '/venv/bin/python' elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then return cwd .. '/.venv/bin/python' else return '/usr/bin/python' end end } } vim.keymap.set("n", "db", "DapToggleBreakpoint", { desc = "Toggle breakpoint" }) vim.keymap.set("n", "dc", "DapContinue", { desc = "Continue" }) vim.keymap.set("n", "dt", "DapTerminate", { desc = "Terminate" }) vim.keymap.set("n", "di", "DapStepInto", { desc = "Step into" }) vim.keymap.set("n", "dn", "DapStepOver", { desc = "Step over" }) vim.keymap.set("n", "do", "DapStepOut", { desc = "Step out" }) vim.keymap.set("n", 'dh', function() require('dap.ui.widgets').hover() end, { desc = "Hover" }) end }, { "rcarriga/nvim-dap-ui", dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" }, config = function() require("dapui").setup({ controls = { enabled = false }, layouts = { { elements = { { id = "scopes", size = 0.33 }, { id = "breakpoints", size = 0.33 }, { id = "stacks", size = 0.33 } }, position = "left", size = 60 }, { elements = { { id = "repl", size = 1 } }, position = "bottom", size = 15 } } }) vim.keymap.set("n", "du", function() require("dapui").toggle() end, { desc = " Toggle UI" }) end } }