diff --git a/configs/nixvim/fiesta/modules/setups/debugging.nix b/configs/nixvim/fiesta/modules/setups/debugging.nix index d3e36d57..b70ddacb 100644 --- a/configs/nixvim/fiesta/modules/setups/debugging.nix +++ b/configs/nixvim/fiesta/modules/setups/debugging.nix @@ -16,5 +16,126 @@ in enable = true; ignoreTreesitter = false; }; + + keymaps = + let + bindingPrefix = "d"; + mkDAPBinding = binding: settings: + { + mode = "n"; + key = "${bindingPrefix}${binding}"; + lua = true; + } // settings; + in + lib.mapAttrsToList mkDAPBinding { + "b" = { + options.desc = "Toggle breakpoint"; + action = "require('dap').toggle_breakpoint"; + }; + + "B" = { + options.desc = "Set breakpoint"; + action = "require('dap').set_breakpoint"; + }; + + "Bp" = { + options.desc = "Set breakpoint with log message"; + action = '' + function() + require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) + end + ''; + }; + + "n" = { + options.desc = "Continue"; + action = "require('dap').continue"; + }; + + # You know, like a comma is supposed to do. I got nothing on this one + # but this is the best choice for now. + "," = { + options.desc = "Pause"; + action = "require('dap').pause"; + }; + + "d" = { + options.desc = "Terminate"; + action = "require('dap').terminate"; + }; + + "l" = { + options.desc = "Step over"; + action = "require('dap').step_over"; + }; + + "j" = { + options.desc = "Step into"; + action = "require('dap').step_into"; + }; + + "J" = { + options.desc = "Go up"; + action = "require('dap').up"; + }; + + "k" = { + options.desc = "Step out"; + action = "require('dap').step_out"; + }; + + "K" = { + options.desc = "Go down"; + action = "require('dap').down"; + }; + + "rs" = { + options.desc = "Restart session"; + action = "require('dap').restart"; + }; + + "rr" = { + options.desc = "Open debugging REPL"; + action = "require('dap').repl.open"; + }; + + "rl" = { + options.desc = "Run last configuration"; + action = "require('dap').run_last"; + }; + + "ph" = { + options.desc = "View the value under the cursor"; + action = "require('dap.ui.widgets').hover"; + mode = [ "n" "v" ]; + }; + + "pp" = { + options.desc = "See value in preview window"; + action = "require('dap.ui.widgets').preview"; + mode = [ "n" "v" ]; + }; + } + ++ lib.mapAttrsToList mkDAPBinding { + "" = { + options.desc = "Continue"; + action = "require('dap').continue"; + }; + + "" = { + options.desc = "Step over"; + action = "require('dap').step_over"; + }; + + "" = { + options.desc = "Step into"; + action = "require('dap').step_into"; + }; + + "" = { + options.desc = "Step out"; + action = "require('dap').step_out"; + }; + }; }; }