added debugger

This commit is contained in:
Brett Mattas 2026-06-05 07:42:44 -05:00
parent d86a975343
commit 4a0bd0fd4f
5 changed files with 87 additions and 5 deletions

View File

@ -16,7 +16,7 @@ require 'autocmd'
require 'terminal'
require 'lazy-bootstrap'
require 'lazy-plugins'
-- require 'debug'
--[[
Links & Notes:
@ -38,10 +38,7 @@ TODO:
(DONE) Lookup mini.files config video. Want to close when I select a file.
(DONE) Use nvim-lite terminal options Add multiline add function
(DONE) Variable o/O behavior)
Add additional options for terminal. Want to be able to either have middle
popup or have it go over the existing buffer. Esc should close or go back
to last buffer.
Tone down the yellow for Command. It is very bright when searching
--]]
-- The line beneath this is called `modeline`. See `:help modeline`

View File

@ -7,12 +7,17 @@
"guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "3d89e7c92fbd96c5e10e0298fc2b006f21cf9428" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "9a10e096703966335bd5c46c8c875d5b0690dade" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" },
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
"mini.nvim": { "branch": "main", "commit": "9b935c218ddba02e5dc75c94f90143bce1f7c646" },
"neo-tree.nvim": { "branch": "main", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-dap": { "branch": "master", "commit": "531771530d4f82ad2d21e436e3cc052d68d7aebb" },
"nvim-dap-python": { "branch": "master", "commit": "1808458eba2b18f178f990e01376941a42c7f93b" },
"nvim-dap-ui": { "branch": "master", "commit": "1a66cabaa4a4da0be107d5eda6d57242f0fe7e49" },
"nvim-lspconfig": { "branch": "master", "commit": "238583bb00770b079c68c69a860d65e5d1d8acf9" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-treesitter": { "branch": "main", "commit": "19c729dae6e0eeb79423df0cf37780aa9a7cc3b7" },
"nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },

View File

@ -19,6 +19,7 @@ require('lazy').setup({
require 'plugins.todo-highlight',
require 'plugins.mini',
require 'plugins.neo-tree',
require 'plugins.debug',

78
lua/plugins/debug.lua Normal file
View File

@ -0,0 +1,78 @@
--[[
<F4> dap.terminate()
<F5> dap.continue()
<F6> dap.pause()
<F7> step_over()
<F8> step_into()
<F9> step_out()
<F10> dapui.toggle() manually shows/hides the UI panels (useful if they get closed or you want to hide them)
<leader>db toggle_breakpoint() sets or removes a breakpoint on the current line
<leader>dB set_breakpoint() with an input prompt lets you set a conditional breakpoint, e.g. x > 5, so it only pauses when the condition is true
--]]
return {
'mfussenegger/nvim-dap',
dependencies = {
-- DAP UI
'rcarriga/nvim-dap-ui',
'nvim-neotest/nvim-nio', -- required by dap-ui
-- Mason integration for auto-installing adapters
-- NOTE: Mason is required in the lsp configuration
'jay-babu/mason-nvim-dap.nvim',
-- Python-specific
'mfussenegger/nvim-dap-python',
},
keys = {
{ '<F4>', function() require('dap').terminate() end, desc = 'Debug: Terminate' },
{ '<F5>', function() require('dap').continue() end, desc = 'Debug: Start/Continue' },
{ '<F6>', function() require('dap').pause() end, desc= 'Debug: Pause '},
{ '<F7>', function() require('dap').step_over() end, desc = 'Debug: Step Over' },
{ '<F8>', function() require('dap').step_into() end, desc = 'Debug: Step Into' },
{ '<F9>', function() require('dap').step_out() end, desc = 'Debug: Step Out' },
{ '<F10>', function() require('dapui').toggle() end, desc = 'Debug: Toggle UI' },
{ '<leader>db', function() require('dap').toggle_breakpoint() end, desc = 'Debug: Toggle Breakpoint' },
{
'<leader>dB',
function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end,
desc = 'Debug: Set Conditional Breakpoint',
},
{ '<leader>du', function() require('dapui').toggle() end, desc = 'Degug: Toggle UI'},
},
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
-- Auto-install debugpy via Mason
require('mason-nvim-dap').setup {
automatic_installation = true,
handlers = {},
ensure_installed = { 'debugpy' },
}
-- Point nvim-dap-python at the debugpy Mason installs
require('dap-python').setup(
vim.fn.stdpath 'data' .. '/mason/packages/debugpy/venv/bin/python'
)
-- DAP UI setup
dapui.setup {
icons = { expanded = '', collapsed = '', current_frame = '*' },
controls = {
icons = {
pause = '', play = '', step_into = '', step_over = '',
step_out = '', step_back = 'b', run_last = '▶▶',
terminate = '', disconnect = '',
},
},
}
-- Auto open/close UI with debug session
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
end,
}

View File

@ -16,6 +16,7 @@ return { -- Useful plugin to show you pending keybinds.
{ '<leader>n', group = '[N]avigate' },
{ '<leader>r', group = 'myvim[R]c'},
{ '<leader>t', group = '[T]erminal'},
{ '<leader>d', group = '[D]ebug'}
},
},
}