aboutsummaryrefslogtreecommitdiff
path: root/lua/kickstart
diff options
context:
space:
mode:
authorVladislav Grechannik <52157081+VlaDexa@users.noreply.github.com>2024-07-21 22:24:57 +0200
committerGitHub <noreply@github.com>2024-07-21 16:24:57 -0400
commit4bbca64157af07cf0550c16d336cfd7513d10946 (patch)
tree9b9c82fd40b3450bc029c21595b2d24c16df0be9 /lua/kickstart
parent1cdf6fb377f4594f803b5aa675777635b6d18074 (diff)
Make debug lazy loadable (#978)
Diffstat (limited to 'lua/kickstart')
-rw-r--r--lua/kickstart/plugins/debug.lua35
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