dotfiles/mzte-nv/conf/lua/pluginconf/nvim_dap.lua

55 lines
1.5 KiB
Lua
Raw Normal View History

2022-11-13 21:10:33 +01:00
local map = vim.api.nvim_set_keymap
2022-11-14 16:26:12 +01:00
local mztenv = require "mzte_nv"
2022-11-13 21:10:33 +01:00
local dap = require "dap"
local dapui = require "dapui"
dapui.setup {}
dap.adapters.lldb = {
type = "executable",
2022-11-14 16:26:12 +01:00
command = mztenv.utils.findInPath "lldb-vscode", -- included in lldb package
2022-11-13 21:10:33 +01:00
name = "lldb",
}
dap.configurations.c = {
{
name = "Launch",
type = "lldb",
request = "launch",
program = function()
return vim.fn.input "Binary: "
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
args = function()
2022-11-13 21:31:04 +01:00
return vim.split(vim.fn.input "Args: ", " ")
2022-11-13 21:10:33 +01:00
end,
runInTerminal = true,
},
}
dap.configurations.cpp = dap.configurations.c
-- TODO: maybe some way to discover the executable here with cargo n stuff?
dap.configurations.rust = dap.configurations.c
dap.configurations.zig = dap.configurations.c
dap.configurations.java = {
{
type = "java",
request = "attach",
name = "Java attach",
hostName = "127.0.0.1",
port = 5005,
},
}
local opts = { noremap = true, silent = true }
map("n", "fu", [[<cmd>lua require("dapui").toggle()<CR>]], opts)
map("n", "fb", [[<cmd>lua require("dap").toggle_breakpoint()<CR>]], opts)
map("n", "fc", [[<cmd>lua require("dap").continue()<CR>]], opts)
map("n", "fn", [[<cmd>lua require("dap").step_over()<CR>]], opts)
map("n", "fi", [[<cmd>lua require("dap").step_into()<CR>]], opts)
map("n", "fo", [[<cmd>lua require("dap").step_out()<CR>]], opts)