From 4bf46eacbb49f922cae86555961c1503c7928e15 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Thu, 21 Sep 2023 16:14:22 -0500 Subject: [PATCH] feat(nvim): add debug module to hydra --- .../nvim/lua/plugins/configs/hydra.lua | 79 +++++++++++++------ 1 file changed, 55 insertions(+), 24 deletions(-) diff --git a/dots/.config/nvim/lua/plugins/configs/hydra.lua b/dots/.config/nvim/lua/plugins/configs/hydra.lua index 82c95ccb..e6561161 100644 --- a/dots/.config/nvim/lua/plugins/configs/hydra.lua +++ b/dots/.config/nvim/lua/plugins/configs/hydra.lua @@ -14,15 +14,6 @@ return { event = { "BufReadPre", "BufNewFile" }, config = function() local hydra = require("hydra") - local wk = require("which-key") - wk.register({ - h = { - name = "Hydra", - o = { "Options" }, - g = { "Git Signs" }, - d = { "Diagram" }, - }, - }, { prefix = "" }) -- Side Scroll hydra({ @@ -30,7 +21,7 @@ return { config = { { position = "bottom-right", - border = "rounded", + border = "solid", }, }, mode = "n", @@ -55,13 +46,14 @@ return { ]] hydra({ + name = "Git", hint = hint, config = { color = "pink", invoke_on_body = true, hint = { position = "bottom-right", - border = "rounded", + border = "solid", }, on_enter = function() vim.bo.modifiable = false @@ -107,7 +99,7 @@ return { { "u", gitsigns.undo_stage_hunk }, { "S", gitsigns.stage_buffer }, { "p", gitsigns.preview_hunk }, - { "d", gitsigns.toggle_deleted, { nowait = true } }, + { "d", gitsigns.toggle_deleted, { nowait = true } }, { "b", gitsigns.blame_line }, { "B", @@ -115,9 +107,9 @@ return { gitsigns.blame_line({ full = true }) end, }, - { "/", gitsigns.show, { exit = true } }, -- show the base of the file + { "/", gitsigns.show, { exit = true } }, -- show the base of the file { "", "Neogit", { exit = true } }, - { "q", nil, { exit = true, nowait = true } }, + { "q", nil, { exit = true, nowait = true } }, }, }) @@ -129,7 +121,7 @@ return { config = { { position = "bottom-right", - border = "rounded", + border = "solid", }, }, heads = { @@ -140,6 +132,45 @@ return { }, }) + -- Hydra for DAP + hydra({ + name = "Debug", + mode = "n", + body = "hd", + hint = [[ +^^Debug +^ +_c_: Continue/Start _r_: Run Last _e_: End/Stop +_b_: Toggle Breakpoint _l_: Toggle Log Breakpoint _B_: Toggle Conditional Breakpoint + +^^ _s_: Toggle DAP UI _R_: Run to cursor + +^^ __: Step Over __: Step Into +^^ __: Step Out __: Step Back + ]], + heads = { + { "c", ":DapContinue" }, + { "r", ":DapRunLast" }, + { "e", ":DapTerminate" }, + { "b", ":DapToggleBreakpoint" }, + { "B", function() require("dap").set_breakpoint(vim.fn.input("Breakpoint Condition: ")) end }, + { "l", function() require("dap").set_breakpoint(vim.fn.input("Breakpoint Condition: ")) end }, + { "s", require("dapui").toggle }, + { "R", require("dap").run_to_cursor }, + { "", ":DapStepOver" }, + { "", ":DapStepInto" }, + { "", ":DapStepOut" }, + { "", require("dap").step_back } + }, + config = { + color = "pink", + invoke_on_body = true, + hint = { + border = "solid" + } + } + }) + -- Hydra for diagrams hydra({ @@ -154,7 +185,7 @@ return { color = "pink", invoke_on_body = true, hint = { - border = "rounded", + border = "solid", }, on_enter = function() vim.o.virtualedit = "all" @@ -163,14 +194,14 @@ return { end, }, mode = "n", - body = "hd", + body = "hD", heads = { - { "H", "h:VBox" }, - { "J", "j:VBox" }, - { "K", "k:VBox" }, - { "L", "l:VBox" }, - { "f", ":VBox", { mode = "v" } }, - { "", nil, { exit = true } }, + { "H", "h:VBox" }, + { "J", "j:VBox" }, + { "K", "k:VBox" }, + { "L", "l:VBox" }, + { "f", ":VBox", { mode = "v" } }, + { "", nil, { exit = true } }, }, }) @@ -193,7 +224,7 @@ return { color = "amaranth", invoke_on_body = true, hint = { - border = "rounded", + border = "solid", position = "middle", }, },