feat(nvim): add more dap keybinds and highlights

chezmoi
sgoudham 2 years ago
parent 1a77028712
commit 1b1db2631c
Signed by: hammy
GPG Key ID: 44E818FD5457EEA4

@ -14,12 +14,13 @@ end
return { return {
{ {
"jayp0521/mason-nvim-dap.nvim", "jayp0521/mason-nvim-dap.nvim",
lazy = false,
config = function() config = function()
local dap = require("dap") local dap = require("dap")
local mason_dap = require("mason-nvim-dap") local mason_dap = require("mason-nvim-dap")
mason_dap.setup({ mason_dap.setup({
ensure_installed = { "python", "codelldb" }, ensure_installed = { "python", "codelldb", "java-debug-adapter", "java-test" },
automatic_setup = true, automatic_setup = true,
}) })
mason_dap.setup_handlers({ mason_dap.setup_handlers({
@ -67,69 +68,70 @@ return {
-- apply suggestions from catppuccin theme -- apply suggestions from catppuccin theme
local sign = vim.fn.sign_define local sign = vim.fn.sign_define
sign("DapBreakpoint", { text = "", texthl = "DapBreakpoint", linehl = "", numhl = "" }) sign("DapBreakpoint", { text = "", texthl = "DapBreakpoint", linehl = "DapBreakpointLinehl", numhl = "" })
sign("DapStopped", { text = "", texthl = "Error", linehl = "DapStoppedLinehl", numhl = "" })
sign("DapBreakpointCondition", { text = "", texthl = "DapBreakpointCondition", linehl = "", numhl = "" }) sign("DapBreakpointCondition", { text = "", texthl = "DapBreakpointCondition", linehl = "", numhl = "" })
sign("DapLogPoint", { text = "", texthl = "DapLogPoint", linehl = "", numhl = "" }) sign("DapLogPoint", { text = "", texthl = "DapLogPoint", linehl = "", numhl = "" })
end, end,
-- stylua: ignore
keys = { keys = {
{ "<leader>bb", vim.cmd.DapToggleBreakpoint, desc = "Toggle Breakpoint" }, { "<leader>bb", vim.cmd.DapToggleBreakpoint, desc = "Toggle Breakpoint" },
{ { "<leader>bf", function() require("dap").list_breakpoints() end, desc = "List Breakpoints", },
"<leader>bf", { "<leader>bc", function() require("dap").clear_breakpoints() end, desc = "Clear Breakpoints", },
function()
require("dap").list_breakpoints()
end,
desc = "List Breakpoints",
},
{
"<leader>bc",
function()
require("dap").clear_breakpoints()
end,
desc = "Clear Breakpoints",
},
{ "<leader>dc", vim.cmd.DapContinue, desc = "Start / Continue" }, { "<leader>dc", vim.cmd.DapContinue, desc = "Start / Continue" },
{ { "<leader>dj", function() require("dap").step_over() end, desc = "Step Over", },
"<leader>dj", { "<leader>dk", function() require("dap").step_into() end, desc = "Step Into", },
function() { "<leader>do", function() require("dap").step_out() end, desc = "Step Out", },
require("dap").step_over() { "<leader>dd", function() require("dap").disconnect() end, desc = "Disconnect", },
end, { "<leader>dr", function() require("dap").restart() end, desc = "Restart", },
desc = "Step Over",
{ "<leader>du", function() require("dapui").toggle({}) end, desc = "Toggle UI", },
{ "<leader>dt", function() require("dap.repl").toggle() end, desc = "Toggle REPL", },
}, },
dependencies = {
"williamboman/mason.nvim",
{ {
"<leader>dk", "mfussenegger/nvim-dap",
function() config = function()
require("dap").step_into() local dap, dapui = require("dap"), require("dapui")
dap.listeners.after.event_initialized["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
end, end,
desc = "Step Into",
}, },
{ {
"<leader>do", "rcarriga/nvim-dap-ui",
function() opts = {
require("dap").step_out() -- stylua: ignore
end, layouts = {
desc = "Step Out",
},
{ {
"<leader>dd", elements = {
function() { id = "stacks", size = 0.15, },
require("dap").disconnect() { id = "repl", size = 0.05, },
end, { id = "scopes", size = 0.40, },
desc = "Disconnect", -- { id = "breakpoints", size = 0.25, },
{ id = "watches", size = 0.40, },
},
position = "left",
size = 40,
}, },
{ {
"<leader>du", elements = {
function() { id = "console", size = 1, },
require("dapui").toggle({}) },
end, position = "bottom",
desc = "Toggle UI", size = 10,
},
},
}, },
}, },
dependencies = {
"williamboman/mason.nvim",
"mfussenegger/nvim-dap",
{ "rcarriga/nvim-dap-ui", config = true },
{ "theHamsta/nvim-dap-virtual-text", config = true }, { "theHamsta/nvim-dap-virtual-text", config = true },
}, },
}, },

Loading…
Cancel
Save