@@ -24,14 +24,67 @@ return {
2424 -- Add your own debuggers here
2525 ' leoluz/nvim-dap-go' ,
2626 },
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+ },
2780 config = function ()
2881 local dap = require ' dap'
2982 local dapui = require ' dapui'
3083
3184 require (' mason-nvim-dap' ).setup {
3285 -- Makes a best effort to setup the various debuggers with
3386 -- reasonable debug configurations
34- automatic_setup = true ,
87+ automatic_installation = true ,
3588
3689 -- You can provide additional configuration to the handlers,
3790 -- see mason-nvim-dap README for more information
@@ -45,16 +98,6 @@ return {
4598 },
4699 }
47100
48- -- Basic debugging keymaps, feel free to change to your liking!
49- vim .keymap .set (' n' , ' <F5>' , dap .continue , { desc = ' Debug: Start/Continue' })
50- vim .keymap .set (' n' , ' <F1>' , dap .step_into , { desc = ' Debug: Step Into' })
51- vim .keymap .set (' n' , ' <F2>' , dap .step_over , { desc = ' Debug: Step Over' })
52- vim .keymap .set (' n' , ' <F3>' , dap .step_out , { desc = ' Debug: Step Out' })
53- vim .keymap .set (' n' , ' <leader>b' , dap .toggle_breakpoint , { desc = ' Debug: Toggle Breakpoint' })
54- vim .keymap .set (' n' , ' <leader>B' , function ()
55- dap .set_breakpoint (vim .fn .input ' Breakpoint condition: ' )
56- end , { desc = ' Debug: Set Breakpoint' })
57-
58101 -- Dap UI setup
59102 -- For more information, see |:help nvim-dap-ui|
60103 dapui .setup {
@@ -77,14 +120,29 @@ return {
77120 },
78121 }
79122
80- -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
81- vim .keymap .set (' n' , ' <F7>' , dapui .toggle , { desc = ' Debug: See last session result.' })
123+ -- Change breakpoint icons
124+ -- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
125+ -- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
126+ -- local breakpoint_icons = vim.g.have_nerd_font
127+ -- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
128+ -- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
129+ -- for type, icon in pairs(breakpoint_icons) do
130+ -- local tp = 'Dap' .. type
131+ -- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
132+ -- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
133+ -- end
82134
83135 dap .listeners .after .event_initialized [' dapui_config' ] = dapui .open
84136 dap .listeners .before .event_terminated [' dapui_config' ] = dapui .close
85137 dap .listeners .before .event_exited [' dapui_config' ] = dapui .close
86138
87139 -- Install golang specific config
88- require (' dap-go' ).setup ()
140+ require (' dap-go' ).setup {
141+ delve = {
142+ -- On Windows delve must be run attached or it crashes.
143+ -- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
144+ detached = vim .fn .has ' win32' == 0 ,
145+ },
146+ }
89147 end ,
90148}
0 commit comments