hydra.nvim icon indicating copy to clipboard operation
hydra.nvim copied to clipboard

Hydra for debugging with nvim-dap

Open phha opened this issue 3 years ago • 0 comments

A hydra for debugging with nvim-dap. Just dropping this here in the hopes that somebody may find this useful.

Screenshot 2022-11-17 at 20 17 40
local dap = require('dap')
local hint = [[
     ^ ^Step^ ^ ^      ^ ^     Action
 ----^-^-^-^--^-^----  ^-^-------------------  
     ^ ^back^ ^ ^     ^_t_: toggle breakpoint 
     ^ ^ _K_^ ^        _T_: clear breakpoints 
 out _H_ ^ ^ _L_ into  _c_: continue
     ^ ^ _J_ ^ ^       _x_: terminate
     ^ ^over ^ ^     ^^_r_: open repl

     ^ ^  _q_: exit
]]
require('hydra') {
  name = 'Debug',
  hint = hint,
  config = {
    color = 'pink',
    invoke_on_body = true,
    hint = {
      type = 'window'
    },
  },
  mode = { 'n' },
  body = '<leader>d,',
  heads = {
    { 'H', dap.step_out,{ desc = 'step out' } },
    { 'J', dap.step_over, { desc = 'step over' } },
    { 'K', dap.step_back, { desc = 'step back' } },
    { 'L', dap.step_into, { desc = 'step into' } },
    { 't', dap.toggle_breakpoint, { desc = 'toggle breakpoint' } },
    { 'T', dap.clear_breakpoints, { desc = 'clear breakpoints' } },
    { 'c', dap.continue, { desc = 'continue' } },
    { 'x', dap.terminate, { desc = 'terminate' } },
    { 'r', dap.repl.open, { exit = true, desc = 'open repl' } },
    { 'q', nil, { exit = true, nowait = true, desc = 'exit' } },
  }
}

phha avatar Nov 17 '22 20:11 phha