diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/alpha/dap.lua | 87 | ||||
| -rw-r--r-- | lua/alpha/plugins.lua | 1 |
2 files changed, 50 insertions, 38 deletions
diff --git a/lua/alpha/dap.lua b/lua/alpha/dap.lua index 326ab60..6215f95 100644 --- a/lua/alpha/dap.lua +++ b/lua/alpha/dap.lua @@ -53,43 +53,54 @@ dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open({}) end --- command to start debugging --- run dap continue and enable the keybindings --- when finish delete all keybindings - --- TODO create a hydra for debug - -local bindings = { - { mode = "n", lhs = "<leader>dd", rhs = dap.continue }, - { mode = "n", lhs = "<leader>dbp", rhs = dap.toggle_breakpoint }, - { mode = "n", lhs = "<leader>dl", rhs = dap.step_into }, - { mode = "n", lhs = "<leader>dj", rhs = dap.step_over }, - { mode = "n", lhs = "<leader>dk", rhs = dap.step_out }, - { mode = "n", lhs = "<leader>dc", rhs = dap.run_to_cursor }, - { mode = "v", lhs = "<leader>dv", rhs = dapui.eval }, - { mode = "n", lhs = "<leader>dcb", rhs = function () - vim.ui.input({prompt = "Condition: "}, function (condition) - dap.toggle_breakpoint(condition) - end) - end }, -} - -vim.keymap.set("n", "<leader>dst", function() - dap.continue() - for _, bind in pairs(bindings) do - vim.keymap.set(bind.mode, bind.lhs, bind.rhs, { noremap = true }) - end -end, { noremap = true }) - -vim.keymap.set("n", "<leader>dsp", function() - dap.terminate() - dapui.close({}) - dap.clear_breakpoints() +local hydra = require("hydra") +local hint = [[ + Nvim DAP + _d_: Start/Continue _j_: StepOver _k_: StepOut _l_: StepInto ^ + _bp_: Toogle Breakpoint _cb_: Conditional Breakpoint ^ + _c_: Run To Cursor _tt_: Go Debug Test + _sp_: Stop Debbuging + ^^ _<Esc>_ +]] +hydra({ + name = "dap", + hint = hint, + mode = "n", + config = { + color = "amaranth", + invoke_on_body = true, + hint = { + border = "rounded", + position = "bottom", + }, + }, + body = "<leader>d", + heads = { + { "d", dap.continue }, + { "bp", dap.toggle_breakpoint }, + { "l", dap.step_into }, + { "j", dap.step_over }, + { "k", dap.step_out }, + { "c", dap.run_to_cursor }, + { "tt", dap_go.debug_test }, + { + "cb", + function() + vim.ui.input({ prompt = "Condition: " }, function(condition) + dap.toggle_breakpoint(condition) + end) + end, + }, - for _, bind in pairs(bindings) do - vim.keymap.del(bind.mode, bind.lhs) - end -end, { noremap = true }) + { + "sp", + function() + dap.terminate() + dapui.close({}) + dap.clear_breakpoints() + end, + }, --- can be skipped since I can do it running the continue and promt to use the "Debug test" -vim.keymap.set("n", "<leader>dtt", dap_go.debug_test, { noremap = true }) + { "<Esc>", nil, { exit = true } }, + }, +}) diff --git a/lua/alpha/plugins.lua b/lua/alpha/plugins.lua index cc17db0..a332ff8 100644 --- a/lua/alpha/plugins.lua +++ b/lua/alpha/plugins.lua @@ -149,6 +149,7 @@ return require("packer").startup(function(use) "nvim-treesitter/nvim-treesitter", "antoinemadec/FixCursorHold.nvim", "nvim-neotest/neotest-go", + "nvim-neotest/neotest-plenary", "nvim-neotest/neotest-vim-test", }, }) |