You've already forked dotfiles
142 lines
4.3 KiB
Lua
142 lines
4.3 KiB
Lua
vim.pack.add({
|
||
'https://github.com/rcarriga/nvim-dap-ui',
|
||
'https://github.com/mfussenegger/nvim-dap',
|
||
'https://github.com/nvim-neotest/nvim-nio',
|
||
'https://github.com/theHamsta/nvim-dap-virtual-text',
|
||
})
|
||
|
||
require('dapui').setup({
|
||
mappings = {
|
||
open = 'o',
|
||
remove = 'd',
|
||
edit = 'e',
|
||
repl = 'r',
|
||
toggle = 't',
|
||
},
|
||
layouts = {
|
||
{
|
||
elements = {
|
||
'scopes',
|
||
'breakpoints',
|
||
'stacks',
|
||
},
|
||
size = 0.33,
|
||
position = 'right',
|
||
},
|
||
{
|
||
elements = {
|
||
'console',
|
||
'watches',
|
||
},
|
||
size = 0.2,
|
||
position = 'bottom',
|
||
},
|
||
},
|
||
floating = {
|
||
max_height = nil,
|
||
max_width = nil,
|
||
border = 'single',
|
||
mappings = {
|
||
close = { 'q', '<Esc>' },
|
||
},
|
||
},
|
||
windows = {
|
||
indent = 1
|
||
},
|
||
render = {
|
||
max_type_length = nil,
|
||
},
|
||
})
|
||
|
||
require('nvim-dap-virtual-text').setup()
|
||
-- local mason_dap = require('mason-nvim-dap')
|
||
local dap, dapui = require('dap'), require('dapui')
|
||
|
||
-- mason_dap.setup({
|
||
-- ensure_installed = {
|
||
-- 'codelldb',
|
||
-- 'debugpy',
|
||
-- },
|
||
-- automatic_installation = true,
|
||
-- handlers = {
|
||
-- function(config)
|
||
-- require('mason-nvim-dap').default_setup(config)
|
||
-- end,
|
||
-- }
|
||
-- })
|
||
|
||
dap.listeners.before.attach.dapui_config = function()
|
||
dapui.open()
|
||
end
|
||
dap.listeners.before.launch.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
|
||
|
||
-- vim.fn.sign_define('DapBreakpoint', { text = 'ᛒ', texthl = '', lineh = '', numhl = '' })
|
||
vim.fn.sign_define('DapBreakpoint', { text = '🟥', texthl = '', lineh = '', numhl = '' })
|
||
vim.fn.sign_define('DapBreakpointCondition', { text = '🝌', texthl = '', lineh = '', numhl = '' })
|
||
vim.fn.sign_define('DapStopped', { text = '▶️' })
|
||
|
||
dap.adapters.gdb = {
|
||
type = 'executable',
|
||
command = 'gdb',
|
||
args = { '-i', 'dap' },
|
||
}
|
||
|
||
dap.adapters.lldb = {
|
||
command = 'lldb',
|
||
type = 'executable',
|
||
}
|
||
|
||
dap.adapters.debugpy = {
|
||
command = 'debugpy',
|
||
type = 'executable',
|
||
}
|
||
|
||
dap.configurations = {
|
||
rust = {
|
||
{
|
||
type = 'lldb',
|
||
name = 'Debug',
|
||
request = 'launch',
|
||
program = function()
|
||
return vim.fn.getcwd() .. '/target/debug/faultybranches'
|
||
end,
|
||
stopAtBeginningOfMainSubprogram = true,
|
||
},
|
||
},
|
||
python = {
|
||
{
|
||
type = 'python',
|
||
name = 'Launch current file',
|
||
request = 'launch',
|
||
program = '${file}',
|
||
pythonPath = function()
|
||
if vim.env.VIRTUAL_ENV then
|
||
return vim.env.VIRTUAL_ENV .. '/bin/python'
|
||
end
|
||
|
||
return vim.fn.exepath('python3') or vim.fn.exepath('python') or 'python'
|
||
end
|
||
}
|
||
}
|
||
}
|
||
|
||
vim.keymap.set('n', '<leader>b', function ()
|
||
require('dap').toggle_breakpoint()
|
||
end)
|
||
vim.keymap.set('n', '<leader>B', function() require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: ')) end)
|
||
vim.keymap.set({'n', 'v'}, '<leader>dh', function() require('dap.ui.widgets').hover() end)
|
||
vim.keymap.set('n', '<F5>', function() require('dap').continue() end)
|
||
vim.keymap.set('n', '<F6>', function() require('dap').run_to_cursor() end)
|
||
vim.keymap.set('n', '<F8>', function() require('dap').terminate() 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)
|