gabrielgio.lua @ 73f8ec6c9ab2929bb392f0db5922045a9ad62107

 1local dap = require("dap")
 2local key = require("gabrielgio.key")
 3local dapui = require("dapui")
 4
 5key.nnoremap("<F5>", ":lua require'dap'.continue()<CR>")
 6key.nnoremap("<F10>", ":lua require'dap'.step_over()<CR>")
 7key.nnoremap("<F11>", ":lua require'dap'.step_into()<CR>")
 8key.nnoremap("<F12>", ":lua require'dap'.step_out()<CR>")
 9key.nnoremap("<leader>b", ":lua require'dap'.toggle_breakpoint()<CR>")
10key.nnoremap("<leader>B", ":lua require'dap'.set_breakpoint(vim.fn.input('Condition: '))<CR>")
11key.nnoremap("<leader>dr", ":lua require'dap'.repl.open()<CR>")
12key.nnoremap("<Alt-k>", "<Cmd>lua require'dapui'.eval()<CR>")
13
14dap.adapters.delve = {
15	type = "server",
16	host = "127.0.0.1",
17	port = 2345,
18}
19
20dap.adapters.gdb = {
21	id = "gdb",
22	type = "executable",
23	command = "gdb",
24	args = { "--interpreter=dap", "--eval-command", "set print pretty on" },
25}
26
27dap.adapters.lldb = {
28	type = "executable",
29	command = "lldb-vscode", -- adjust as needed, must be absolute path
30	name = "lldb",
31}
32
33dap.configurations.go = {
34	{
35		type = "delve",
36		name = "remote",
37		mode = "remote",
38		request = "attach",
39		connect = {
40			host = "127.0.0.1",
41			port = "2345",
42		},
43	},
44}
45dap.configurations.zig = {
46	{
47		name = "Launch",
48		type = "gdb",
49		request = "launch",
50		program = function()
51			return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
52		end,
53		cwd = "${workspaceFolder}",
54		stopAtBeginningOfMainSubprogram = false,
55		args = function()
56			local args_str = vim.fn.input({
57				prompt = "Arguments: ",
58			})
59			return vim.split(args_str, " +")
60		end,
61	},
62	{
63		name = "Launch",
64		type = "lldb",
65		request = "launch",
66		program = function()
67			return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
68		end,
69		cwd = "${workspaceFolder}",
70		stopAtBeginningOfMainSubprogram = false,
71		args = function()
72			local args_str = vim.fn.input({
73				prompt = "Arguments: ",
74			})
75			return vim.split(args_str, " +")
76		end,
77	},
78}
79
80dapui.setup({
81	layouts = {
82		{
83			elements = {
84				{
85					id = "watches",
86					size = 1,
87				},
88			},
89			position = "bottom",
90			size = 10,
91		},
92	},
93})