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

44 lines
1.3 KiB
Lua

vim.keymap.set('n', '<leader>b', function() require('dap').toggle_breakpoint() end)
vim.keymap.set('n', '<F5>', function() require('dap').continue() end)
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)
require('dap').adapters.lldb = {
type = 'executable',
command = '/usr/bin/lldb-vscode', -- adjust as needed
name = 'lldb',
}
local lldb = {
name = 'Launch lldb',
type = 'lldb', -- matches the adapter
request = 'launch', -- could also attach to a currently running process
program = function()
return vim.fn.input(
'Path to executable: ',
vim.fn.getcwd() .. '/target/debug/',
'file'
)
end,
cwd = '${workspaceFolder}',
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