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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
local dap = require("dap")
local key = require("gabrielgio.key")
local dapui = require("dapui")
local dapgo = require("dap-go")
dapgo.setup()
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>dr", ":lua require'dap'.repl.open()<CR>")
key.nnoremap("<Alt-k>", "<Cmd>lua require'dapui'.eval()<CR>")
dap.adapters.delve = {
type = "server",
host = "127.0.0.1",
port = 2345,
}
dap.adapters.gdb = {
id = "gdb",
type = "executable",
command = "gdb",
args = { "--interpreter=dap", "--eval-command", "set print pretty on" },
}
dap.adapters.lldb = {
type = "executable",
command = "lldb-vscode", -- adjust as needed, must be absolute path
name = "lldb",
}
dap.configurations.go = {
{
type = "delve",
name = "remote",
mode = "remote",
request = "attach",
connect = {
host = "127.0.0.1",
port = "2345",
},
},
}
dap.configurations.zig = {
{
name = "Launch",
type = "gdb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
stopAtBeginningOfMainSubprogram = false,
args = function()
local args_str = vim.fn.input({
prompt = "Arguments: ",
})
return vim.split(args_str, " +")
end,
},
{
name = "Launch",
type = "lldb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
stopAtBeginningOfMainSubprogram = false,
args = function()
local args_str = vim.fn.input({
prompt = "Arguments: ",
})
return vim.split(args_str, " +")
end,
},
}
dapui.setup({
layouts = {
{
elements = {
{
id = "watches",
size = 1,
},
},
position = "bottom",
size = 10,
},
},
})
|