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>dk", function() require("dap").step_into() end, desc = "Step Into", },
{ "<leader>do", function() require("dap").step_out() end, desc = "Step Out", },
{ "<leader>dd", function() require("dap").disconnect() end, desc = "Disconnect", },
{ "<leader>dr", function() require("dap").restart() end, desc = "Restart", },
{ "<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>dj", "mfussenegger/nvim-dap",
function() config = function()
require("dap").step_over() local dap, dapui = require("dap"), require("dapui")
end, dap.listeners.after.event_initialized["dapui_config"] = function()
desc = "Step Over", dapui.open()
}, end
{ dap.listeners.before.event_terminated["dapui_config"] = function()
"<leader>dk", dapui.close()
function() end
require("dap").step_into() dap.listeners.before.event_exited["dapui_config"] = function()
end, dapui.close()
desc = "Step Into", end
},
{
"<leader>do",
function()
require("dap").step_out()
end,
desc = "Step Out",
},
{
"<leader>dd",
function()
require("dap").disconnect()
end, end,
desc = "Disconnect",
}, },
{ {
"<leader>du", "rcarriga/nvim-dap-ui",
function() opts = {
require("dapui").toggle({}) -- stylua: ignore
end, layouts = {
desc = "Toggle UI", {
elements = {
{ id = "stacks", size = 0.15, },
{ id = "repl", size = 0.05, },
{ id = "scopes", size = 0.40, },
-- { id = "breakpoints", size = 0.25, },
{ id = "watches", size = 0.40, },
},
position = "left",
size = 40,
},
{
elements = {
{ id = "console", size = 1, },
},
position = "bottom",
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