Dotfiles/.config/nvim/lua/plugins/editor/editor_debugging.lua

76 lines
3.1 KiB
Lua
Raw Normal View History

2024-05-13 18:43:31 +00:00
return {
2024-05-30 14:31:02 +00:00
{
"mfussenegger/nvim-dap",
dependencies = {
"rcarriga/nvim-dap-ui",
"nvim-neotest/nvim-nio",
},
config = function()
-- Setup Debugging --
local dap = require("dap")
2024-05-13 18:43:31 +00:00
2024-05-30 14:31:02 +00:00
-- Open UI on Debugging --
local dapui = require("dapui")
dapui.setup({
layouts = {
{
elements = {
{ id = "scopes", size = 0.65 },
{ id = "breakpoints", size = 0.35 },
},
position = "left",
size = 40,
},
{
elements = {
2024-06-02 17:11:54 +00:00
{ id = "repl", size = 0.5 },
2024-05-30 14:31:02 +00:00
{ id = "console", size = 0.5 },
},
position = "bottom",
size = 10,
},
},
})
dap.listeners.before.attach.dapui_config = function()
dapui.open()
end
dap.listeners.before.launch.dapui_config = function()
dapui.open()
end
2024-05-13 18:43:31 +00:00
2024-05-30 14:31:02 +00:00
-- Keybinding --
2024-05-31 17:00:10 +00:00
vim.keymap.set("n", "<Leader>dt", dapui.toggle, { desc = "Toggle Debugger UI" })
2024-05-30 14:31:02 +00:00
vim.keymap.set("n", "<Leader>db", dap.toggle_breakpoint, { desc = "Toggle Breakpoint" })
vim.keymap.set("n", "<Leader>dc", dap.continue, { desc = "Debugger Continue" })
vim.keymap.set("n", "<Leader>dx", dap.terminate, { desc = "Debugger Terminate" })
vim.keymap.set("n", "<Leader>ds", dap.step_over, { desc = "Debugger Step Over" })
2024-05-13 18:43:31 +00:00
2024-05-30 14:31:02 +00:00
-- Breakpoints --
vim.api.nvim_set_hl(0, "DapBreakpoint", { ctermbg = 0, fg = "#993939", bg = "#31353f" })
vim.api.nvim_set_hl(0, "DapLogPoint", { ctermbg = 0, fg = "#61afef", bg = "#31353f" })
vim.api.nvim_set_hl(0, "DapStopped", { ctermbg = 0, fg = "#98c379", bg = "#31353f" })
vim.fn.sign_define(
2024-05-13 18:43:31 +00:00
"DapBreakpoint",
{ text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
2024-05-30 14:31:02 +00:00
)
vim.fn.sign_define(
2024-05-13 18:43:31 +00:00
"DapBreakpointCondition",
{ text = "󰣏", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
2024-05-30 14:31:02 +00:00
)
vim.fn.sign_define(
2024-05-13 18:43:31 +00:00
"DapBreakpointRejected",
{ text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
2024-05-30 14:31:02 +00:00
)
vim.fn.sign_define(
2024-05-13 18:43:31 +00:00
"DapLogPoint",
{ text = "", texthl = "DapLogPoint", linehl = "DapLogPoint", numhl = "DapLogPoint" }
2024-05-30 14:31:02 +00:00
)
vim.fn.sign_define(
2024-05-13 18:43:31 +00:00
"DapStopped",
{ text = "", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" }
2024-05-30 14:31:02 +00:00
)
end,
},
2024-05-31 17:00:10 +00:00
require("plugins.editor.debugging.debugging_go"),
2024-05-13 18:43:31 +00:00
}