nvim-dap.lua (1985B)
1 local dap = require('dap') 2 dap.adapters.codelldb = { 3 type = 'server', 4 port = "${port}", 5 executable = { 6 -- CHANGE THIS to your path! 7 command = 'codelldb', 8 args = {"--port", "${port}"}, 9 10 -- On windows you may have to uncomment this: 11 -- detached = false, 12 } 13 } 14 dap.configurations.rust = { 15 { 16 name = "Launch file", 17 type = "codelldb", 18 request = "launch", 19 program = function() 20 return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') 21 end, 22 cwd = '${workspaceFolder}', 23 stopOnEntry = false, 24 }, 25 } 26 vim.keymap.set('n', '<localleader>dc', function() require('dap').continue() end, { desc = '[D]ebug [c]ontinue' }) 27 vim.keymap.set('n', '<localleader>dn', function() require('dap').step_over() end, { desc = '[D]ebug [n]ext' }) 28 vim.keymap.set('n', '<localleader>di', function() require('dap').step_into() end, { desc = '[D]ebug [i]n' }) 29 vim.keymap.set('n', '<localleader>df', function() require('dap').step_out() end, { desc = '[D]ebug [f]inish' }) 30 vim.keymap.set('n', '<localleader>db', function() require('dap').toggle_breakpoint() end, { desc = '[D]ebug [b]reak toggle' }) 31 vim.keymap.set('n', '<localleader>dB', function() require('dap').set_breakpoint() end, { desc = '[D]ebug [B]reak set' }) 32 vim.keymap.set('n', '<localleader>dm', function() require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) end, { desc = '[D]ebug [m]essage' }) 33 vim.keymap.set('n', '<localleader>dr', function() require('dap').repl.open() end, { desc = '[D]ebug [r]epl' }) 34 vim.keymap.set('n', '<localleader>dC', function() require('dap').run_last() end, { desc = '[D]ebug last' }) 35 vim.keymap.set('n', '<localleader>dj', function() require('dap').focus_frame() end, { desc = '[D]ebug [j]ump to frame' }) 36 vim.keymap.set('n', '<localleader>dH', function() require('dap').goto_(nil) end, { desc = '[D]ebug [H]ere' }) 37 vim.keymap.set('n', '<localleader>dS', function() require('dap').close() end, { desc = '[D]ebug [S]top' })