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

Mon, 26 Aug 2024 14:23:43 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 26 Aug 2024 14:23:43 -0500
changeset 1177
93b5d2db30bc
parent 1165
840f0fde07e2
permissions
-rw-r--r--

more gopls config. add inlay hint toggle

1165
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 return {
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 {
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3 "mfussenegger/nvim-dap",
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 dependencies = {
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5 {
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6 "rcarriga/nvim-dap-ui",
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 dependencies = { "nvim-neotest/nvim-nio" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8 -- stylua: ignore
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 keys = {
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10 { "<leader>du", function() require("dapui").toggle({ }) end, desc = "Dap UI" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11 { "<leader>de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12 },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13 opts = {
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14 controls = {
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15 icons = {
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
16 disconnect = "[d]",
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17 pause = "[p]",
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18 play = "[c]",
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
19 run_last = "[l]",
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
20 step_back = "[u]",
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
21 step_into = "[i]",
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
22 step_out = "[O]",
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
23 step_over = "[o]",
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
24 terminate = "[t]",
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
25 }
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
26 }
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
27 },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
28 config = function(_, opts)
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
29 local dap = require("dap")
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
30 local dapui = require("dapui")
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
31 dapui.setup(opts)
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
32 dap.listeners.after.event_initialized["dapui_config"] = function()
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
33 dapui.open({})
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
34 end
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
35 dap.listeners.before.event_terminated["dapui_config"] = function()
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
36 dapui.close({})
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
37 end
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
38 dap.listeners.before.event_exited["dapui_config"] = function()
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
39 dapui.close({})
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
40 end
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
41 end,
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
42 },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
43 { "theHamsta/nvim-dap-virtual-text", config = true },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
44 { "leoluz/nvim-dap-go", config = true },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
45 { "suketa/nvim-dap-ruby", config = true },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
46 },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
47
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
48 -- stylua: ignore
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
49 keys = {
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
50 { "<leader>dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
51 { "<leader>db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
52 { "<leader>dc", function() require("dap").continue() end, desc = "Continue" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
53 { "<leader>da", function() require("dap").continue({ before = vim.fn.input("Args: ") }) end, desc = "Run with Args" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
54 { "<leader>dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
55 { "<leader>dg", function() require("dap").goto_() end, desc = "Go to Line (No Execute)" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
56 { "<leader>di", function() require("dap").step_into() end, desc = "Step Into" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
57 { "<leader>dj", function() require("dap").down() end, desc = "Down" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
58 { "<leader>dk", function() require("dap").up() end, desc = "Up" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
59 { "<leader>dl", function() require("dap").run_last() end, desc = "Run Last" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
60 { "<leader>dO", function() require("dap").step_out() end, desc = "Step Out" }, -- switched o/O from lazyvim
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
61 { "<leader>do", function() require("dap").step_over() end, desc = "Step Over" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
62 { "<leader>dp", function() require("dap").pause() end, desc = "Pause" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
63 { "<leader>dr", function() require("dap").repl.toggle() end, desc = "Toggle REPL" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
64 { "<leader>ds", function() require("dap").session() end, desc = "Session" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
65 { "<leader>dt", function() require("dap").terminate() end, desc = "Terminate" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
66 { "<leader>dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
67 },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
68 },
840f0fde07e2 set up nvim-dap etc
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
69 }

mercurial