From fb3c96d50d625db725940625120012c75afc17f6 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Fri, 14 Jun 2024 19:06:50 +0200 Subject: feat: Initial commit --- lua/gabrielgio/dap.lua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lua/gabrielgio/dap.lua (limited to 'lua/gabrielgio/dap.lua') diff --git a/lua/gabrielgio/dap.lua b/lua/gabrielgio/dap.lua new file mode 100644 index 0000000..2534c7a --- /dev/null +++ b/lua/gabrielgio/dap.lua @@ -0,0 +1,32 @@ +local dap = require("dap") +local key = require("gabrielgio.key") +local dapgo = require("dap-go") + +dapgo.setup({delve = {build_flags = "-tags=unit,integration,e2e"}}) + +key.nnoremap("", ":lua require'dap'.continue()") +key.nnoremap("", ":lua require'dap'.step_over()") +key.nnoremap("", ":lua require'dap'.step_into()") +key.nnoremap("", ":lua require'dap'.step_out()") +key.nnoremap("b", ":lua require'dap'.toggle_breakpoint()") +key.nnoremap("B", ":lua require'dap'.set_breakpoint(vim.fn.input('Condition: '))") +key.nnoremap("dt", ":lua require'dap-go'.debug_test()") +key.nnoremap("dr", ":lua require'dap'.repl.open()") + +dap.adapters.gdb = { + type = "executable", + command = "gdb", + args = { "-i", "dap" } +} + +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}", + }, +} -- cgit v1.2.3