nvim: Add nvim-dap configuration
Automatically opens dap-view when in debugging session (and closes when done), sets some breakpoint jump logic and makes the gutter symbols nicer. Adds keybinds for most of the dap operations with `<localleader>d<something>` where something is the operation (i.e. `c` for continue, `b` for breakpoint and so on).
This commit is contained in:
parent
bbab0f1674
commit
3454c60c44
2 changed files with 108 additions and 2 deletions
|
|
@ -56,6 +56,9 @@
|
|||
"nvim-FeMaco.lua": { "branch": "main", "commit": "96bbf843595dbe865838b3f2484b73557f34700c" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" },
|
||||
"nvim-coverage": { "branch": "main", "commit": "a939e425e363319d952a6c35fb3f38b34041ded2" },
|
||||
"nvim-dap": { "branch": "master", "commit": "6a5bba0ddea5d419a783e170c20988046376090d" },
|
||||
"nvim-dap-python": { "branch": "master", "commit": "261ce649d05bc455a29f9636dc03f8cdaa7e0e2c" },
|
||||
"nvim-dap-view": { "branch": "main", "commit": "fc0315087a871f9e74ef88559760b81dae81bc6d" },
|
||||
"nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "77d3fdfb3554632c7a3b101ded643d422de7626f" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
|
|
|
|||
|
|
@ -94,13 +94,13 @@ return {
|
|||
{
|
||||
"<localleader>tw",
|
||||
[[<cmd>lua require('neotest').watch.toggle()<cr>]],
|
||||
desc = "watch current test",
|
||||
desc = "watch current test toggle",
|
||||
silent = true,
|
||||
},
|
||||
{
|
||||
"<localleader>tW",
|
||||
[[<cmd>lua require('neotest').watch.toggle(vim.fn.expand("%"))<cr>]],
|
||||
desc = "watch current file",
|
||||
desc = "watch current file toggle",
|
||||
silent = true,
|
||||
},
|
||||
},
|
||||
|
|
@ -149,4 +149,107 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
-- {
|
||||
-- "rcarriga/nvim-dap-ui",
|
||||
-- config = true,
|
||||
-- keys = {
|
||||
-- {
|
||||
-- "<leader>sb",
|
||||
-- function()
|
||||
-- require("dapui").toggle({})
|
||||
-- end,
|
||||
-- desc = "Dap UI",
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
{
|
||||
"igorlfs/nvim-dap-view",
|
||||
opts = {},
|
||||
keys = {
|
||||
{
|
||||
"<leader>sb",
|
||||
function()
|
||||
require("dap-view").toggle()
|
||||
end,
|
||||
desc = "Dap UI",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
if require("core.util").is_available("which-key") then
|
||||
require("which-key").add({ "<localleader>d", group = "debug" })
|
||||
end
|
||||
end,
|
||||
config = function()
|
||||
local dap, dv = require("dap"), require("dap-view")
|
||||
dap.listeners.before.attach["dap-view-config"] = function()
|
||||
dv.open()
|
||||
end
|
||||
dap.listeners.before.launch["dap-view-config"] = function()
|
||||
dv.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated["dap-view-config"] = function()
|
||||
dv.close()
|
||||
end
|
||||
dap.listeners.before.event_exited["dap-view-config"] = function()
|
||||
dv.close()
|
||||
end
|
||||
-- Signs
|
||||
for _, group in pairs({
|
||||
"DapBreakpoint",
|
||||
"DapBreakpointCondition",
|
||||
"DapBreakpointRejected",
|
||||
"DapLogPoint",
|
||||
}) do
|
||||
vim.fn.sign_define(group, { text = "●", texthl = group })
|
||||
end
|
||||
vim.fn.sign_define("DapStopped", { text = "", texthl = "DapStopped", numhl = "debugPC" })
|
||||
-- jump to stopped-at breakpoint if it is visible in a tab or open a new tab
|
||||
require("dap").defaults.fallback.switchbuf = "usevisible,usetab,newtab"
|
||||
end,
|
||||
keys = {
|
||||
{ "<localleader>dc", require("dap").continue, desc = "continue" },
|
||||
{ "<localleader>dt", require("dap").terminate, desc = "terminate" },
|
||||
{ "<localleader>dr", require("dap").run_to_cursor, desc = "run to cursor" },
|
||||
{ "<localleader>dj", require("dap").step_over, desc = "step over" },
|
||||
{ "<localleader>dl", require("dap").step_into, desc = "step into" },
|
||||
{ "<localleader>dh", require("dap").step_out, desc = "step out" },
|
||||
{ "<localleader>[d", require("dap").up, desc = "DAP up" },
|
||||
{ "<localleader>]d", require("dap").down, desc = "DAP down" },
|
||||
|
||||
{ "<localleader>db", require("dap").toggle_breakpoint, desc = "toggle breakpoint" },
|
||||
{
|
||||
"<localleader>dB",
|
||||
function()
|
||||
vim.ui.input({ prompt = "Breakpoint condition: " }, function(input)
|
||||
require("dap").set_breakpoint(input)
|
||||
end)
|
||||
end,
|
||||
desc = "set logpoint",
|
||||
},
|
||||
{
|
||||
"<localleader>dL",
|
||||
function()
|
||||
vim.ui.input({ prompt = "Log point message: " }, function(input)
|
||||
require("dap").set_breakpoint(nil, nil, input)
|
||||
end)
|
||||
end,
|
||||
desc = "set logpoint",
|
||||
},
|
||||
|
||||
{ "<localleader>dk", require("dap.ui.widgets").hover, desc = "hover" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap-python",
|
||||
dependencies = { { "mfussenegger/nvim-dap", optional = true } },
|
||||
ft = { "python" },
|
||||
config = function()
|
||||
require("dap-python").setup("debugpy-adapter")
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue