diff options
Diffstat (limited to 'lua/kickstart/plugins/debug.lua')
-rw-r--r-- | lua/kickstart/plugins/debug.lua | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 31dfecf..196f2c6 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -24,6 +24,28 @@ return { -- Add your own debuggers here 'leoluz/nvim-dap-go', }, + keys = function(_, keys) + local dap = require 'dap' + local dapui = require 'dapui' + return { + -- Basic debugging keymaps, feel free to change to your liking! + { '<F5>', dap.continue, desc = 'Debug: Start/Continue' }, + { '<F1>', dap.step_into, desc = 'Debug: Step Into' }, + { '<F2>', dap.step_over, desc = 'Debug: Step Over' }, + { '<F3>', dap.step_out, desc = 'Debug: Step Out' }, + { '<leader>b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' }, + { + '<leader>B', + function() + dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') + end, + desc = 'Debug: Set Breakpoint', + }, + -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. + { '<F7>', dapui.toggle, desc = 'Debug: See last session result.' }, + unpack(keys), + } + end, config = function() local dap = require 'dap' local dapui = require 'dapui' @@ -45,16 +67,6 @@ return { }, } - -- Basic debugging keymaps, feel free to change to your liking! - vim.keymap.set('n', '<F5>', dap.continue, { desc = 'Debug: Start/Continue' }) - vim.keymap.set('n', '<F1>', dap.step_into, { desc = 'Debug: Step Into' }) - vim.keymap.set('n', '<F2>', dap.step_over, { desc = 'Debug: Step Over' }) - vim.keymap.set('n', '<F3>', dap.step_out, { desc = 'Debug: Step Out' }) - vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) - vim.keymap.set('n', '<leader>B', function() - dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') - end, { desc = 'Debug: Set Breakpoint' }) - -- Dap UI setup -- For more information, see |:help nvim-dap-ui| dapui.setup { @@ -77,9 +89,6 @@ return { }, } - -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. - vim.keymap.set('n', '<F7>', dapui.toggle, { desc = 'Debug: See last session result.' }) - dap.listeners.after.event_initialized['dapui_config'] = dapui.open dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close |