neovim-confs/lua/plex/plugins/extras/lang/cpp.lua

65 lines
1.7 KiB
Lua
Raw Normal View History

2023-09-21 15:58:30 +02:00
return {
{
'mfussenegger/nvim-dap',
2023-09-21 17:30:16 +02:00
-- optional = true,
2023-09-21 15:58:30 +02:00
dependencies = {
'mfussenegger/nvim-dap-python',
},
-- stylua: ignore
-- keys = {
-- { '<leader>dPt', function() require('dap-python').test_method() end, desc = 'Debug Method' },
-- { '<leader>dPc', function() require('dap-python').test_class() end, desc = 'Debug Class' },
-- },
2023-09-21 17:30:16 +02:00
opts = function()
2023-09-21 15:58:30 +02:00
local dap = require('dap')
2023-09-21 17:30:16 +02:00
dap.adapters.cppdbg = {
id = 'cppdbg',
2023-09-21 15:58:30 +02:00
type = 'executable',
2023-09-21 17:30:16 +02:00
command = '/home/cscherr/.local/share/nvim/nvim-dap/debuggers/cpptools/extension/debugAdapters/bin/OpenDebugAD7',
2023-09-21 15:58:30 +02:00
}
2023-09-21 17:30:16 +02:00
dap.configurations.cpp = {
2023-09-21 15:58:30 +02:00
{
2023-09-21 17:30:16 +02:00
name = "Launch file",
type = "cppdbg",
request = "launch",
2023-09-21 15:58:30 +02:00
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
2023-09-21 17:30:16 +02:00
stopAtEntry = true,
setupCommands = {
{
text = '-enable-pretty-printing',
description = 'enable pretty printing',
ignoreFailures = false
},
},
2023-09-21 15:58:30 +02:00
},
{
2023-09-21 17:30:16 +02:00
name = 'Attach to gdbserver :1234',
type = 'cppdbg',
2023-09-21 15:58:30 +02:00
request = 'launch',
2023-09-21 17:30:16 +02:00
MIMode = 'gdb',
miDebuggerServerAddress = 'localhost:1234',
miDebuggerPath = '/usr/bin/gdb',
cwd = '${workspaceFolder}',
2023-09-21 15:58:30 +02:00
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
2023-09-21 17:30:16 +02:00
setupCommands = {
{
text = '-enable-pretty-printing',
description = 'enable pretty printing',
ignoreFailures = false
},
},
2023-09-21 15:58:30 +02:00
},
}
2023-09-21 17:30:16 +02:00
dap.configurations.c = dap.configurations.cpp
dap.configurations.rust = dap.configurations.cpp
2023-09-21 15:58:30 +02:00
end,
},
}