diff --git a/init.lua b/init.lua index c6612067..d309b9a6 100644 --- a/init.lua +++ b/init.lua @@ -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` diff --git a/lazy-lock.json b/lazy-lock.json index 8c84dad1..888a386d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -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" }, diff --git a/lua/lazy-plugins.lua b/lua/lazy-plugins.lua index 295ca26a..16c1bb28 100644 --- a/lua/lazy-plugins.lua +++ b/lua/lazy-plugins.lua @@ -19,6 +19,7 @@ require('lazy').setup({ require 'plugins.todo-highlight', require 'plugins.mini', require 'plugins.neo-tree', + require 'plugins.debug', diff --git a/lua/plugins/debug.lua b/lua/plugins/debug.lua new file mode 100644 index 00000000..8878ac67 --- /dev/null +++ b/lua/plugins/debug.lua @@ -0,0 +1,78 @@ +--[[ + — dap.terminate() + — dap.continue() + — dap.pause() + — step_over() + — step_into() + — step_out() + — dapui.toggle() manually shows/hides the UI panels (useful if they get closed or you want to hide them) +db — toggle_breakpoint() sets or removes a breakpoint on the current line +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 = { + { '', function() require('dap').terminate() end, desc = 'Debug: Terminate' }, + { '', function() require('dap').continue() end, desc = 'Debug: Start/Continue' }, + { '', function() require('dap').pause() end, desc= 'Debug: Pause '}, + { '', function() require('dap').step_over() end, desc = 'Debug: Step Over' }, + { '', function() require('dap').step_into() end, desc = 'Debug: Step Into' }, + { '', function() require('dap').step_out() end, desc = 'Debug: Step Out' }, + { '', function() require('dapui').toggle() end, desc = 'Debug: Toggle UI' }, + { 'db', function() require('dap').toggle_breakpoint() end, desc = 'Debug: Toggle Breakpoint' }, + { + 'dB', + function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, + desc = 'Debug: Set Conditional Breakpoint', + }, + { '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, +} diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua index 563ae949..4bb29270 100644 --- a/lua/plugins/which-key.lua +++ b/lua/plugins/which-key.lua @@ -16,6 +16,7 @@ return { -- Useful plugin to show you pending keybinds. { 'n', group = '[N]avigate' }, { 'r', group = 'myvim[R]c'}, { 't', group = '[T]erminal'}, + { 'd', group = '[D]ebug'} }, }, }