aboutsummaryrefslogtreecommitdiff
path: root/lua/gabrielgio/dap.lua
blob: 2534c7a17e9070d029d74f89d4422e19f726a854 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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("<F5>", ":lua require'dap'.continue()<CR>")
key.nnoremap("<F10>", ":lua require'dap'.step_over()<CR>")
key.nnoremap("<F11>", ":lua require'dap'.step_into()<CR>")
key.nnoremap("<F12>", ":lua require'dap'.step_out()<CR>")
key.nnoremap("<leader>b", ":lua require'dap'.toggle_breakpoint()<CR>")
key.nnoremap("<leader>B", ":lua require'dap'.set_breakpoint(vim.fn.input('Condition: '))<CR>")
key.nnoremap("<leader>dt", ":lua require'dap-go'.debug_test()<CR>")
key.nnoremap("<leader>dr", ":lua require'dap'.repl.open()<CR>")

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}",
    },
}