Skip to content

Commit 8dc0247

Browse files
kaezrrkiran079
authored andcommitted
Fix nvim-dap not lazy loading (nvim-lua#1216)
* Fix nvim-dap not lazy loading The keys property had local variables 'dap' and 'dap-ui' that used `require` and prevented all DAP related plugins from lazy-loading. Fixed this by changing keys to a table and substituting the local variables with a lamba function * Make debug keybind descriptions more consistent
1 parent 40cfa1a commit 8dc0247

File tree

1 file changed

+53
-22
lines changed

1 file changed

+53
-22
lines changed

lua/kickstart/plugins/debug.lua

Lines changed: 53 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,59 @@ return {
2424
-- Add your own debuggers here
2525
'leoluz/nvim-dap-go',
2626
},
27-
keys = function(_, keys)
28-
local dap = require 'dap'
29-
local dapui = require 'dapui'
30-
return {
31-
-- Basic debugging keymaps, feel free to change to your liking!
32-
{ '<F5>', dap.continue, desc = 'Debug: Start/Continue' },
33-
{ '<F1>', dap.step_into, desc = 'Debug: Step Into' },
34-
{ '<F2>', dap.step_over, desc = 'Debug: Step Over' },
35-
{ '<F3>', dap.step_out, desc = 'Debug: Step Out' },
36-
{ '<leader>b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' },
37-
{
38-
'<leader>B',
39-
function()
40-
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
41-
end,
42-
desc = 'Debug: Set Breakpoint',
43-
},
44-
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
45-
{ '<F7>', dapui.toggle, desc = 'Debug: See last session result.' },
46-
unpack(keys),
47-
}
48-
end,
27+
keys = {
28+
-- Basic debugging keymaps, feel free to change to your liking!
29+
{
30+
'<F5>',
31+
function()
32+
require('dap').continue()
33+
end,
34+
desc = 'Debug: Start/Continue',
35+
},
36+
{
37+
'<F1>',
38+
function()
39+
require('dap').step_into()
40+
end,
41+
desc = 'Debug: Step Into',
42+
},
43+
{
44+
'<F2>',
45+
function()
46+
require('dap').step_over()
47+
end,
48+
desc = 'Debug: Step Over',
49+
},
50+
{
51+
'<F3>',
52+
function()
53+
require('dap').step_out()
54+
end,
55+
desc = 'Debug: Step Out',
56+
},
57+
{
58+
'<leader>b',
59+
function()
60+
require('dap').toggle_breakpoint()
61+
end,
62+
desc = 'Debug: Toggle Breakpoint',
63+
},
64+
{
65+
'<leader>B',
66+
function()
67+
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
68+
end,
69+
desc = 'Debug: Set Breakpoint',
70+
},
71+
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
72+
{
73+
'<F7>',
74+
function()
75+
require('dapui').toggle()
76+
end,
77+
desc = 'Debug: See last session result.',
78+
},
79+
},
4980
config = function()
5081
local dap = require 'dap'
5182
local dapui = require 'dapui'

0 commit comments

Comments
 (0)