.config/nvim/after/plugin/dap.lua

44 lines
1.3 KiB
Lua
Raw Normal View History

vim.keymap.set('n', '<leader>b', function() require('dap').toggle_breakpoint() end)
2023-03-16 20:13:34 +00:00
vim.keymap.set('n', '<F5>', function() require('dap').continue() end)
2023-03-15 22:17:00 +00:00
vim.keymap.set('n', '<F10>', function() require('dap').step_over() end)
vim.keymap.set('n', '<F11>', function() require('dap').step_into() end)
vim.keymap.set('n', '<F12>', function() require('dap').step_out() end)
2023-03-13 19:58:45 +00:00
require('dap').adapters.lldb = {
type = 'executable',
command = '/usr/bin/lldb-vscode', -- adjust as needed
name = 'lldb',
2023-03-13 19:58:45 +00:00
}
local lldb = {
name = 'Launch lldb',
type = 'lldb', -- matches the adapter
request = 'launch', -- could also attach to a currently running process
2023-03-13 19:58:45 +00:00
program = function()
return vim.fn.input(
'Path to executable: ',
vim.fn.getcwd() .. '/target/debug/',
'file'
2023-03-13 19:58:45 +00:00
)
end,
cwd = '${workspaceFolder}',
2023-03-13 19:58:45 +00:00
stopOnEntry = false,
args = {},
runInTerminal = false,
}
require('dap').configurations.rust = {
lldb -- different debuggers or more configurations can be used here
}
require("dapui").setup()
local dap, dapui = require("dap"), require("dapui")
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end