X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/6b7257e9c5c2a51b67a89979cb1476732d082151..b47ffe60e244c9165f40371736079320ea2d848b:/nvim/lua/plugins/dap.lua diff --git a/nvim/lua/plugins/dap.lua b/nvim/lua/plugins/dap.lua index 7df6094..483d40f 100644 --- a/nvim/lua/plugins/dap.lua +++ b/nvim/lua/plugins/dap.lua @@ -1,3 +1,15 @@ +---@param config {args?:string[]|fun():string[]?} +local function get_args(config) + local args = type(config.args) == "function" and (config.args() or {}) or config.args or {} + config = vim.deepcopy(config) + ---@cast args string[] + config.args = function() + local new_args = vim.fn.input("Run with args: ", table.concat(args, " ")) --[[@as string]] + return vim.split(vim.fn.expand(new_args) --[[@as string]], " ") + end + return config +end + return { "mfussenegger/nvim-dap", @@ -18,12 +30,6 @@ return { 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 end, }, @@ -33,16 +39,6 @@ return { opts = {}, }, - -- which key integration - { - "folke/which-key.nvim", - opts = { - defaults = { - ["d"] = { name = "+debug" }, - }, - }, - }, - -- mason.nvim integration { "jay-babu/mason-nvim-dap.nvim", @@ -107,14 +103,19 @@ return { { "dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" }, { "db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" }, { "dc", function() require("dap").continue() end, desc = "Continue" }, + { "da", function() require("dap").continue({ before = get_args }) end, desc = "Run with Args" }, { "dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" }, + { "", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" }, { "dg", function() require("dap").goto_() end, desc = "Go to line (no execute)" }, { "di", function() require("dap").step_into() end, desc = "Step Into" }, + { "", function() require("dap").step_into() end, desc = "Step Into" }, { "dj", function() require("dap").down() end, desc = "Down" }, { "dk", function() require("dap").up() end, desc = "Up" }, { "dl", function() require("dap").run_last() end, desc = "Run Last" }, { "do", function() require("dap").step_out() end, desc = "Step Out" }, + { "", function() require("dap").step_out() end, desc = "Step Over" }, { "dO", function() require("dap").step_over() end, desc = "Step Over" }, + { "", function() require("dap").step_over() end, desc = "Step Over" }, { "dp", function() require("dap").pause() end, desc = "Pause" }, { "dr", function() require("dap").repl.toggle() end, desc = "Toggle REPL" }, { "ds", function() require("dap").session() end, desc = "Session" },