add nvim dap

This commit is contained in:
Sean Villars 2025-02-10 16:27:17 -06:00
parent a2b2834f9a
commit 74fd55a90e
3 changed files with 92 additions and 2 deletions

View File

@ -1026,7 +1026,7 @@ require('lazy').setup({
-- This is the easiest way to modularize your config.
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- { import = 'custom.plugins' },
{ import = 'custom.plugins' },
--
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
-- Or use telescope!

View File

@ -9,7 +9,6 @@
"gitsigns.nvim": { "branch": "main", "commit": "68114837e81ca16d06514c3a997c9102d1b25c15" },
"lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" },
"lazydev.nvim": { "branch": "main", "commit": "8620f82ee3f59ff2187647167b6b47387a13a018" },
"luvit-meta": { "branch": "main", "commit": "55709f183b0742a7e4f47688c284f81148ad4dc0" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "97d9f1d3ad205dece6bcafd1d71cf1507608f3c7" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
@ -18,7 +17,12 @@
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
"nvim-autopairs": { "branch": "master", "commit": "d2f791ceeb26d04d87aa54343bc94e8ad8d7be1c" },
"nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" },
"nvim-dap": { "branch": "master", "commit": "52302f02fea3a490e55475de52fa4deb8af2eb11" },
"nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" },
"nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" },
"nvim-lspconfig": { "branch": "master", "commit": "88157521e890fe7fdf18bee22438875edd6300a6" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-treesitter": { "branch": "master", "commit": "306dd6e9dc806db1d79568d26e1c9b6c98b95fbc" },
"nvim-treesitter-context": { "branch": "master", "commit": "d0dd7ce5a9d0be1f28086e818e52fdc5c78975df" },
"nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" },

View File

@ -0,0 +1,86 @@
return {
{
'mfussenegger/nvim-dap',
dependencies = {
'nvim-neotest/nvim-nio',
'rcarriga/nvim-dap-ui',
'mfussenegger/nvim-dap-python',
'theHamsta/nvim-dap-virtual-text',
},
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
local dap_python = require 'dap-python'
require('dapui').setup {}
require('nvim-dap-virtual-text').setup {
commented = true, -- Show virtual text alongside comment
}
dap_python.setup 'uv'
vim.fn.sign_define('DapBreakpoint', {
text = '',
texthl = 'DiagnosticSignError',
linehl = '',
numhl = '',
})
vim.fn.sign_define('DapBreakpointRejected', {
text = '', -- or "❌"
texthl = 'DiagnosticSignError',
linehl = '',
numhl = '',
})
vim.fn.sign_define('DapStopped', {
text = '', -- or "→"
texthl = 'DiagnosticSignWarn',
linehl = 'Visual',
numhl = 'DiagnosticSignWarn',
})
-- Automatically open/close DAP UI
dap.listeners.after.event_initialized['dapui_config'] = function()
dapui.open()
end
local opts = { noremap = true, silent = true }
-- Toggle breakpoint
vim.keymap.set('n', '<leader>db', function()
dap.toggle_breakpoint()
end, opts)
-- Continue / Start
vim.keymap.set('n', '<leader>dc', function()
dap.continue()
end, opts)
-- Step Over
vim.keymap.set('n', '<leader>do', function()
dap.step_over()
end, opts)
-- Step Into
vim.keymap.set('n', '<leader>di', function()
dap.step_into()
end, opts)
-- Step Out
vim.keymap.set('n', '<leader>dO', function()
dap.step_out()
end, opts)
-- Keymap to terminate debugging
vim.keymap.set('n', '<leader>dq', function()
require('dap').terminate()
end, opts)
-- Toggle DAP UI
vim.keymap.set('n', '<leader>du', function()
dapui.toggle()
end, opts)
end,
},
}